1.0.0 • Published 4 years ago

@pi0/req-url v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

req-url

Easily grab full URL from a request (http.IncomingMessage) object.

Features

  • Browser fall-back
  • Detect HTTPS requests using is-https
  • Super Small (282B min-gzip)

Usage

ESM import:

import reqURL from 'req-url'

CommonJS import:

const reqURL = require('req-url')

Default export signuture is:

reqURL(request?: http.IncomingMessage): String

Example:

const url = getURL(req)
// http://localhost:3000/aaf/dfdf
// https://www.foo.com/foo/bar

License

MIT