You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

express-http-context

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-http-context - npm Package Compare versions

Comparing version

to
1.0.4

2

package.json
{
"name": "express-http-context",
"version": "1.0.3",
"version": "1.0.4",
"description": "Get and set request-scoped context anywhere",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -15,4 +15,9 @@ [![travis](https://img.shields.io/travis/skonves/express-http-context.svg)](https://travis-ci.org/skonves/express-http-context)

Use the middleware. The earlier the better; you won't have access to the context from any middleware "used" before this one.
Use the middleware immediately before the first middleware that needs to have access to the context.
You won't have access to the context in any middleware "used" before this one.
Note that some popular middlewares (such as body-parser, express-jwt) may cause context to get lost.
To workaround such issues, you are advised to use any third party middleware that does NOT need the context
BEFORE you use this middleware.
``` js

@@ -23,3 +28,4 @@ var express = require('express');

var app = express();
// Use any third party middleware that does not need access to the context here, e.g.
// app.use(some3rdParty.middleware);
app.use(httpContext.middleware);

@@ -60,3 +66,2 @@ // all code from here on has access to the same context for each request

1. Make sure you require `express-http-context` in the first row of your app. Some popular packages use async which breaks CLS.
1. If you are using `body-parser` and context is getting lost, register it in express before you register `express-http-context`'s middleware.

@@ -71,1 +76,2 @@ For users of Node 10

Amiram Korach (@amiram)
Yoni Rabinovitch (@yonirab)