Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@podium/context

Package Overview
Dependencies
Maintainers
3
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@podium/context - npm Package Compare versions

Comparing version 3.0.0-beta.1 to 3.0.0-beta.2

CHANGELOG.md

44

lib/context.js

@@ -17,2 +17,3 @@ 'use strict';

const Debug = require('./get-debug');
const State = require('./state');

@@ -78,2 +79,26 @@ const PREFIX = 'podium';

process(req, res) {
// TODO: replace with a instance check when there is one PodiumState
// class used by multiple modules.
let state;
if (Object.prototype.toString.call(req) === '[object PodiumState]') {
state = req;
} else {
state = new State(req, res);
}
const parsers = Array.from(this.parsers);
return Promise.all(
parsers.map(parser =>
parser[1].parse(state.request, state.response),
),
).then(result => {
result.forEach((item, index) => {
const key = `${PREFIX}-${parsers[index][0]}`;
state.context[decamelize(key, '-')] = item;
});
return state;
});
}
middleware() {

@@ -93,16 +118,9 @@ return (req, res, next) => {

const parsers = Array.from(this.parsers);
Promise.all(parsers.map(parser => parser[1].parse(req, res)))
.then(result => {
const context = {};
result.forEach((item, index) => {
const key = `${PREFIX}-${parsers[index][0]}`;
context[decamelize(key, '-')] = item;
});
utils.setAtLocalsPodium(res, 'context', context);
this.process(req, res)
.then(state => {
successTimer();
next();
if (state) {
utils.setAtLocalsPodium(res, 'context', state.context);
next();
}
})

@@ -109,0 +127,0 @@ .catch(error => {

'use strict';
const bowser = require('bowser');
const lru = require('lru-cache');
const Bowser = require('bowser');
const LRU = require('lru-cache');

@@ -19,3 +19,3 @@ const symCapabilitiesToType = Symbol('_capabilitiesToType');

Object.defineProperty(this, 'cache', {
value: lru({
value: new LRU({
max: this.cacheSize,

@@ -30,7 +30,7 @@ }),

[symCapabilitiesToType](capabilities) {
if (capabilities.mobile) {
[symCapabilitiesToType](platformType) {
if (platformType === 'mobile') {
return 'mobile';
}
if (capabilities.tablet) {
if (platformType === 'tablet') {
return 'tablet';

@@ -53,4 +53,5 @@ }

// eslint-disable-next-line no-underscore-dangle
const capabilities = bowser._detect(userAgent);
type = this[symCapabilitiesToType](capabilities);
const capabilities = Bowser.getParser(userAgent);
const platformType = capabilities.getPlatformType();
type = this[symCapabilitiesToType](platformType);
this.cache.set(userAgent.toLowerCase(), type);

@@ -57,0 +58,0 @@ }

{
"name": "@podium/context",
"version": "3.0.0-beta.1",
"license": "MIT",
"description": "Serialize and de-serialize a Podium Context.",
"repository": {
"type": "git",
"url": "git@github.schibsted.io:Podium/context.git"
},
"main": "./lib/context.js",
"files": [
"lib"
],
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"test": "jest",
"test:verbose": "jest --verbose",
"test:coverage": "jest --coverage"
},
"keywords": [],
"author": "",
"dependencies": {
"@metrics/client": "1.0.0",
"@podium/schemas": "3.0.0-beta.1",
"@podium/utils": "3.0.0-beta.1",
"bcp47-validate": "^1.0.0",
"boom": "^7.2.0",
"bowser": "^1.9.4",
"decamelize": "^2.0.0",
"joi": "^14.0.1",
"lru-cache": "^4.1.2",
"original-url": "^1.2.1"
},
"devDependencies": {
"benchmark": "^2.1.4",
"express": "^4.16.3",
"jest": "^23.6.0",
"eslint": "^5.6.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-config-prettier": "^3.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-prettier": "^3.0.0",
"prettier": "^1.14.2"
}
"name": "@podium/context",
"version": "3.0.0-beta.2",
"description": "Module to generate the context which is passed on requests from a Layout server to a Podlet server",
"license": "MIT",
"keywords": [
"micro services",
"micro frontend",
"components",
"podium"
],
"repository": {
"type": "git",
"url": "git@github.com:podium-lib/context.git"
},
"bugs": {
"url": "https://github.com/podium-lib/issues"
},
"homepage": "https://podium-lib.io/",
"main": "./lib/context.js",
"files": [
"lib"
],
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"test": "jest",
"test:verbose": "jest --verbose",
"test:coverage": "jest --coverage"
},
"author": "",
"dependencies": {
"@metrics/client": "2.3.0",
"@podium/schemas": "3.0.0",
"@podium/utils": "3.0.0",
"bcp47-validate": "^1.0.0",
"boom": "^7.2.0",
"bowser": "^2.1.0",
"decamelize": "^2.0.0",
"joi": "^14.3.1",
"lru-cache": "^5.1.1",
"original-url": "^1.2.1"
},
"devDependencies": {
"benchmark": "^2.1.4",
"jest": "^24.0.0",
"eslint": "^5.12.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-prettier": "^3.0.1",
"prettier": "^1.16.1"
}
}
# Podium Context
[![Build Status](https://travis-ci.org/podium-lib/context.svg?branch=master)](https://travis-ci.org/podium-lib/context)
[![Greenkeeper badge](https://badges.greenkeeper.io/podium-lib/context.svg)](https://greenkeeper.io/)
[![Known Vulnerabilities](https://snyk.io/test/github/podium-lib/context/badge.svg)](https://snyk.io/test/github/podium-lib/context)
Module to generate, serialize and de-serialize a Podium Context.

@@ -11,6 +15,5 @@

## Example
Simple Layout server requesting a Podlet server:
Simple Layout server requesting content from a Podlet server:

@@ -33,3 +36,3 @@ ```js

// A GET route requesting a Podlet server. The context
// is serialized and appended as http headers to the
// is serialized and appended as HTTP headers to the
// request to the Podlet server.

@@ -41,3 +44,3 @@ app.get('/', (req, res) => {

method: 'GET',
url: 'http://some.podlet.finn.no/'
url: 'http://some.podlet.finn.no/',
}).pipe(res);

@@ -57,3 +60,3 @@ });

// Attache context de-serialize middelware which will
// Attach context de-serialize middleware which will
// transform the context into a usable object.

@@ -70,3 +73,2 @@ // The context will be stored at: `res.locals.podium.context`

## Description

@@ -79,23 +81,23 @@

This module handles generating wanted key information in the Layout server and seralizing
it into HTTP headers which is passed on to the requests to the Podlet servers where the
HTTP headers again is parsed back into a key / value object with the key information.
it into HTTP headers which are passed on to requests to the Podlet servers where the
HTTP headers are once again parsed back into a key / value object with the key information.
There are three parts in this module:
* Parsers
* Middleware to run parsers
* Serializing / deserializing
- Parsers
- Middleware to run parsers
- Serializing / deserializing
Each part work as follow:
Each part works as follow:
### Parsers
A parser work on a inbound request in the Layout server. The parser has access to the
http `request` and `response` objects in a Layout server. Upon this a parser builds a
value which will be applied as part of the context which is appended to the requests
to the Podlet servers.
A parser works on an inbound request to the Layout server. The parser has access to the
HTTP `request` and `response` objects in a Layout server. Upon this a parser builds a
value which will be applied as part of the context which is appended to requests
to Podlet servers.
This module come with a set of built in parsers which will always be applied.
This module comes with a set of built in parsers which will always be applied.
Its possible to write custom parsers and append them to the process of constructing
It's also possible to write custom parsers and append them to the process of constructing
the context.

@@ -105,7 +107,7 @@

The middleware is an Connect compatible middleware which run on all http requests in
the Layout server and run all registered parsers.
The middleware is a Connect compatible middleware which runs on all HTTP requests to
the Layout server and runs all registered parsers.
The middleware store the result of each parser as an object on the `res.locals.podium.context`.
This object is "http header like" and can be serialized into headers on a http request
The middleware stores the result of each parser as an object on the response at `res.locals.podium.context`.
This object is "HTTP header like" and can be serialized into headers on an HTTP request
to a Podlet.

@@ -115,10 +117,9 @@

These are `static` methods used to serialize and deserialize the "http header like"
object from `res.locals.podium.context` into http headers on the http request to Podlet
These are `static` methods used to serialize and deserialize the "HTTP header like"
object from `res.locals.podium.context` into HTTP headers on the HTTP request to a Podlet
and then back into a object on `res.locals.podium.context` in the Podlet server.
## Constructor
Create a new Podium Context instance.
Creates a new Podium context instance.

@@ -130,19 +131,19 @@ ```js

The constructor take the following arguments:
The constructor takes the following arguments:
### options
| option | default | type | required | details |
| -------------- | --------- | -------- | -------- | -------------------- |
| name | `null` | `string` | `true` | |
| debug | `null` | `object` | `false` | [See parser options](#debug) |
| locale | `null` | `object` | `false` | [See parser options](#locale) |
| deviceType | `null` | `object` | `false` | [See parser options](#device-type) |
| mountOrigin | `null` | `object` | `false` | [See parser options](#mount-origin) |
| mountPathname | `null` | `object` | `false` | [See parser options](#mount-pathname) |
| publicPathname | `null` | `object` | `false` | [See parser options](#public-pathname) |
| option | default | type | required | details |
| -------------- | ------- | -------- | -------- | -------------------------------------- |
| name | `null` | `string` | `true` | |
| debug | `null` | `object` | `false` | [See parser options](#debug) |
| locale | `null` | `object` | `false` | [See parser options](#locale) |
| deviceType | `null` | `object` | `false` | [See parser options](#device-type) |
| mountOrigin | `null` | `object` | `false` | [See parser options](#mount-origin) |
| mountPathname | `null` | `object` | `false` | [See parser options](#mount-pathname) |
| publicPathname | `null` | `object` | `false` | [See parser options](#public-pathname) |
#### name
A name as a `String` to identify the instance. This should be a logic and human readable name
A name as a `String` to identify the instance. This should be a logical and human readable name
related to the Layout this instance is appended too. This name is passed on to the Podlet

@@ -163,40 +164,38 @@ servers as part of the [Requested By](#requested-by) context.

Config object passed on to the debug parser. See [parsers doc](#debug).
Config object passed on to the debug parser. See the [parser docs](#debug).
#### locale
Config object passed on to the locale parser. See [parsers doc](#locale).
Config object passed on to the locale parser. See the [parser docs](#locale).
#### deviceType
Config object passed on to the device type parser. See [parsers doc](#device-type).
Config object passed on to the device type parser. See the [parser docs](#device-type).
#### mountOrigin
Config object passed on to the mount origin parser. See [parsers doc](#mount-origin).
Config object passed on to the mount origin parser. See the [parser docs](#mount-origin).
#### mountPathname
Config object passed on to the mount pathname parser. See [parsers doc](#mount-pathname).
Config object passed on to the mount pathname parser. See the [parser docs](#mount-pathname).
#### publicPathname
Config object passed on to the public pathname parser. See [parsers doc](#public-pathname).
Config object passed on to the public pathname parser. See the [parser docs](#public-pathname).
## API
The Context instance have the following API:
The Context instance has the following API:
### .register(name, parser)
Register a Parser which should be appended to the Context.
Register a Parser for a value that should be appended to the Context.
The method takes the following arguments:
This method takes the following arguments:
| option | default | type | required | details |
| -------------- | --------- | -------- | -------- | -------------------------------------------------------------------------------- |
| name | `null` | `string` | `true` | Unique name of the parser. Used as the key for the parser's value in the context |
| parser | `null` | `object` | `true` | The Parser to be registered |
| option | default | type | required | details |
| ------ | ------- | -------- | -------- | -------------------------------------------------------------------------------- |
| name | `null` | `string` | `true` | Unique name of the parser. Used as the key for the parser's value in the context |
| parser | `null` | `object` | `true` | The Parser to be registered |

@@ -231,19 +230,18 @@ Example:

Connect compatible middelware to execute all parsers in paralell and append the result of each parser
Connect compatible middleware to execute all parsers in parallel and append the result of each parser
to `res.locals.podium.context`.
This will execute all built in parsers and all externally registered, through the `.register()`
method, parsers.
This will execute all built in parsers as well as all externally registered (through the `.register()`
method) parsers.
## Static API
The Context constructor have the following static API:
The Context constructor has the following static API:
### .serialize(headers, context, podletName)
Takes a "http header-ish" object, produced by `.middleware()` and stored at `res.locals.podium.context`,
and serializes it into a http header object which can be applied to a http request to a Podlet.
Takes an "HTTP header-ish" object produced by `.middleware()` (the `res.locals.podium.context` object)
and serializes it into an HTTP header object which can be applied to HTTP requests sent to podlets.
The object stored at `res.locals.podium.context` is "http header-ish" because the value of each key
The object stored at `res.locals.podium.context` is "HTTP header-ish" because the value of each key
can be either a `String` or a `Function`. If a key holds a `Function` the serializer will call

@@ -254,17 +252,21 @@ the function with the `podletName` argument.

| option | default | type | required | details |
| -------------- | --------- | -------- | -------- | -------------------------------------------------------------------------------- |
| headers | `null` | `object` | `true` | An existing http header Object or empty Object the context should be merged into |
| context | `null` | `object` | `true` | The object produced by `.middleware()`, stored at `res.locals.podium.context` |
| podletName | `null` | `string` | `false` | The name of the podlet the context should be applied too |
| option | default | type | required | details |
| ---------- | ------- | -------- | -------- | -------------------------------------------------------------------------------- |
| headers | `null` | `object` | `true` | An existing HTTP header object or empty object the context should be merged into |
| context | `null` | `object` | `true` | The object produced by `.middleware()` and stored at `res.locals.podium.context` |
| podletName | `null` | `string` | `false` | The name of the podlet the context should be applied to |
Example in Layout server:
Example: layout sends context with a request to a podlet
```js
app.get('/', (req, res) => {
const headers = Context.serialize({}, res.locals.podium.context, 'somePodlet');
const headers = Context.serialize(
{},
res.locals.podium.context,
'somePodlet',
);
request({
headers: headers,
method: 'GET',
url: 'http://some.podlet.finn.no/'
url: 'http://some.podlet.finn.no/',
}).pipe(res);

@@ -276,6 +278,5 @@ });

Connect compatible middelware which will parse http headers on an inbound request in a Podlet
server and turn context headers into a context object stored at `res.locals.podium.context`.
Connect compatible middleware which will parse HTTP headers on inbound requests and turn Podium context headers into a context object stored at `res.locals.podium.context`.
Example in Podlet server:
Example: podlet receives request from a layout server

@@ -290,3 +291,2 @@ ```js

## Internal parsers

@@ -297,4 +297,3 @@

Each of these parsers can be configured through the constructor by passing a options object to
the matching options parameter for the parser on the constructor options object (see constructor options).
Each of these parsers can be configured through with constructor option object by passing an options object to the matching options parameter for the parser in the constructor (see constructor options).

@@ -308,4 +307,4 @@ Example of passing options to the built in `debug` parser:

debug: {
enabled: true
}
enabled: true,
},
});

@@ -318,11 +317,10 @@ ```

Each layout must have a given name to ease the process of identifying it by a human.
Such a name is passed on from a layout to a podlet by this parser. By doing so, its
possible to have a loose identifier for whom are requesting a podlet.
Context header: `podium-requested-by`
Output value from this parser is stored on the `podium-requested-by` header.
Each layout must have a given name to make it more easily human identifiable.
This name value is then passed on from the layout to any podlets in the `podium-requested-by` context header which is generated by running this parser.
#### arguments (required)
This parser takes an required String as the first argument on the constructor.
The parser takes a string (required) as the first argument to the constructor.

@@ -334,3 +332,3 @@ Example:

const context = new Context({
name: 'myName'
name: 'myName',
});

@@ -341,5 +339,5 @@ ```

Indicator for communicating that a layout server are in debug mode to podlets.
Context header: `podium-debug`
Output value from this parser is stored on the `podium-debug` header.
Indicates to podlets when the layout server is in debug mode.

@@ -350,5 +348,5 @@ #### arguments (optional)

| option | default | type | required | details |
| -------------- | --------- | --------- | -------- | ---------------------------------------- |
| enable | `false` | `boolean` | `false` | Indicate if one are in debug mode or not |
| option | default | type | required | details |
| ------ | ------- | --------- | -------- | ------------------------------------------------ |
| enable | `false` | `boolean` | `false` | Indicates whether layout is in debug mode or not |

@@ -360,2 +358,4 @@ This config object is passed on to the `debug` argument on the context object

Context header: `podium-locale`
Locale of the requesting browser. When executed by `.middleware()`, this

@@ -365,7 +365,5 @@ parser will look for a locale at `res.locals.locale`. If found, this

Output value from this parser is stored on the `podium-locale` header.
```js
const context = new Context({
name: 'myName'
name: 'myName',
});

@@ -385,28 +383,27 @@ const app = express();

| option | default | type | required | details |
| -------------- | --------- | --------- | -------- | ------------------------------- |
| locale | `en-US` | `string` | `false` | A bcp47 compliant locale String |
| option | default | type | required | details |
| ------ | ------- | -------- | -------- | ------------------------------- |
| locale | `en-US` | `string` | `false` | A bcp47 compliant locale String |
This config object is passed on to the `locale` property on the config object
on the constructor.
in the constructor.
### Device Type
Context header: `podium-device-type`
A guess at the device type of the requesting browser. Guessing is done by
UA detection and is **not** guaranteed to be accurate.
Output value from this parser is stored on the `podium-device-type` header.
The output value will be one of the following strings:
* `desktop`: The device requesting the podlet is probably a desktop computer
or something with a large screen. This is the **default** if we're not able
to determine anything more detailed.
* `tablet`: The device is probably a tablet of some sort, or a device with a
smaller screen than a desktop.
* `mobile`: The device is probably a phone of some sort, or a device with a
smaller screen than a tablet.
- `desktop`: The device requesting the podlet is probably a desktop computer
or something with a large screen. This is the **default** if we're not able
to determine anything more detailed.
- `tablet`: The device is probably a tablet of some sort, or a device with a
smaller screen than a desktop.
- `mobile`: The device is probably a phone of some sort, or a device with a
smaller screen than a tablet.
This module will internally cache its result and the matching UA string in
an LRU cache for faster lookup.
This module will internally cache its result and the matching UA string in an LRU cache for faster lookup.

@@ -417,17 +414,17 @@ #### arguments (optional)

| option | default | type | required | details |
| -------------- | --------- | --------- | -------- | ---------------------------------------- |
| cacheSize | `10000` | `number` | `false` | How many UA Strings to keep in LRU cache |
| option | default | type | required | details |
| --------- | ------- | -------- | -------- | --------------------------------------------- |
| cacheSize | `10000` | `number` | `false` | Number of UA Strings to keep in the LRU cache |
This config object is passed on to the `deviceType` property on the config
object on the constructor.
object in the constructor.
### Mount Origin
URL origin of the inbound request to the layout server. The parser will try
to parse this from the inbound request to the layout server. Though, it is
possible to override by providing a config.
Context header: `podium-mount-origin`
Output value from this parser is stored on the `podium-mount-origin` header
where the value is a [WHATWG URL](https://url.spec.whatwg.org/) compatible origin
URL origin of the inbound request to the layout server. The parser will try to parse this value from inbound requests to the layout server. It is
also possible to override the value using config.
The value is a [WHATWG URL](https://url.spec.whatwg.org/) compatible origin
[(illustrated overview)](https://nodejs.org/api/url.html#url_url_strings_and_url_objects).

@@ -439,5 +436,5 @@

| option | default | type | required | details |
| -------------- | --------- | --------- | -------- | ------------------------------------------------ |
| origin | null | `string` | `false` | Origin string overriding origin found on request |
| option | default | type | required | details |
| ------ | ------- | -------- | -------- | ------------------------------------------------------------------------- |
| origin | null | `string` | `false` | Origin string that, if present, will override the origin found on request |

@@ -451,16 +448,14 @@ Example:

mountOrigin: {
origin: 'https://example.org/'
}
origin: 'https://example.org/',
},
});
```
This is passed on to the `mountOrigin` property on the config object on the
constructor.
### Mount Pathname
URL pathname of where a Layout is mounted in the http server.
Context header: `podium-mount-pathname`
Output value from this parser is stored on the `podium-mount-pathname` header
where the value is a [WHATWG URL](https://url.spec.whatwg.org/) compatible pathname
URL pathname specifying where a layout is mounted in an HTTP server.
The value is a [WHATWG URL](https://url.spec.whatwg.org/) compatible pathname
[(illustrated overview)](https://nodejs.org/api/url.html#url_url_strings_and_url_objects).

@@ -472,5 +467,5 @@

| option | default | type | required | details |
| -------------- | --------- | --------- | -------- | ------------------------------------------------------ |
| pathname | '/' | `string` | `false` | Pathname of where a Layout is mounted in a http server |
| option | default | type | required | details |
| -------- | ------- | -------- | -------- | --------------------------------------------------------------- |
| pathname | '/' | `string` | `false` | Pathname specifying where a Layout is mounted in an HTTP server |

@@ -485,21 +480,18 @@ Example:

pathname: '/my/path/name',
}
},
});
```
This is passed on to the `mountPathname` property on the config object on the
constructor.
### Public Pathname
URL pathname of where a layout server has mounted a proxy to proxy public
traffic to a podlet. The full public pathname is built up by a given rule where
`pathname` defines where the proxy are mounted in a http server and `prefix`
defines a namespace to isolate the proxy from other http routes defined under
the same pathname.
Context header: `podium-public-pathname`
Its common that `pathname` here is the same as `pathname` in Mount Pathname.
URL pathname indicating where a layout server has mounted a proxy to proxy public
traffic to podlets.
Output value from this parser is stored on the `podium-public-pathname` header
where value is a [WHATWG URL](https://url.spec.whatwg.org/) compatible pathname
The full public pathname is built up joining `pathname` and `prefix` where `pathname` is the pathname to where the proxy is mounted into the HTTP server and `prefix` is a namespace isolating the proxy from other routes defined under the same pathname.
Often `pathname` will be the same value as mount pathname.
The value is a [WHATWG URL](https://url.spec.whatwg.org/) compatible pathname
[(illustrated overview)](https://nodejs.org/api/url.html#url_url_strings_and_url_objects).

@@ -511,6 +503,6 @@

| option | default | type | required | details |
| -------------- | ----------------- | --------- | -------- | ------------------------------------------------------------------------- |
| pathname | '/' | `string` | `false` | Pathname of where a Proxy is mounted in a http server |
| prefix | 'podium-resource' | `string` | `false` | Namespace used to isolate proxy from other routes under the same pathname |
| option | default | type | required | details |
| -------- | ----------------- | -------- | -------- | ----------------------------------------------------------------------------- |
| pathname | '/' | `string` | `false` | Pathname where a Proxy is mounted in a HTTP server |
| prefix | 'podium-resource' | `string` | `false` | Namespace used to isolate the proxy from other routes under the same pathname |

@@ -526,23 +518,17 @@ Example:

prefix: 'proxy',
}
},
});
```
This is passed on to the `publicPathname` property on the config object on the
constructor.
## A word on URL construction
By adhering to [WHATWG URL](https://url.spec.whatwg.org/) when constructing
URLs we can easely compose full URLs by using, ex the [URL module in node.js](https://nodejs.org/api/url.html#url_class_url).
By adhering to the [WHATWG URL](https://url.spec.whatwg.org/) spec when constructing URLs we can easily compose full URLs by using the [URL module in node.js](https://nodejs.org/api/url.html#url_class_url).
Example:
In a podlet, the origin of a layout server will be found on `res.locals.podium.context.mountOrigin`
and the pathname to the layout will be found on `res.locals.podium.context.mountPathname`.
In a podlet, the origin of a layout server can be found at `res.locals.podium.context.mountOrigin`
and the pathname to the layout can be found at `res.locals.podium.context.mountPathname`.
To get the full URL of where a podlet are used in a layout, we can combine
these two by using the [URL module in node.js](https://nodejs.org/api/url.html#url_class_url)
like this:
To get the full URL of where a podlet is used in a layout, we can combine these two by using the [URL module in node.js](https://nodejs.org/api/url.html#url_class_url)
like so:

@@ -555,6 +541,6 @@ ```js

console.log(url.href) // prints full URL
console.log(url.href); // prints full URL
```
The same can be done to construct public URL to the proxy URL:
The same can be done to construct a public URL to the proxy URL:

@@ -567,3 +553,3 @@ ```js

console.log(url.href) // prints full to proxy endpoint
console.log(url.href); // prints full to proxy endpoint
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc