urlful

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

please use https://www.npmjs.com/package/requrl
Last updated a year ago by pi0 .
MIT · Original npm · Tarball · package.json
$ cnpm install urlful 
SYNC missed versions from official npm registry.

urlful

npm dt bundlephobia

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

Features

  • Universal (browser and node.js) support
  • Detect HTTPS requests using is-https
  • Support x-forwarded-proto and x-forwarded-host
  • Always encode URI
  • Super Small

Usage

ESM import:

import getURL from 'urlful'

CommonJS import:

const getURL = require('urlful')

Default export signuture is:

getURL (request?: http.IncomingMessage) : string

Example:

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

License

MIT

Current Tags

  • 1.1.2                                ...           latest (a year ago)

4 Versions

  • 1.1.2 [deprecated]           ...           a year ago
  • 1.1.1 [deprecated]           ...           a year ago
  • 1.1.0 [deprecated]           ...           a year ago
  • 1.0.0 [deprecated]           ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (11)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |