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

lws-request-monitor

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lws-request-monitor - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

11

index.js

@@ -6,3 +6,8 @@ class RequestMonitor {

middleware () {
middleware (config, lws) {
let requestId = 1
lws.server.on('request', (req, res) => {
req.requestId = requestId++
})
return async (ctx, next) => {

@@ -13,3 +18,2 @@ const util = require('util')

const reqInfo = {
socketId: ctx.req.socket.id,
requestId: ctx.req.requestId,

@@ -20,3 +24,3 @@ method: ctx.req.method,

}
// console.log(ctx.request)
if (ctx.request.rawBody) {

@@ -39,3 +43,2 @@ if (Object.keys(ctx.request.body).length) {

const resInfo = {
socketId: ctx.req.socket.id,
requestId: ctx.req.requestId,

@@ -42,0 +45,0 @@ statusCode: ctx.res.statusCode

{
"name": "lws-request-monitor",
"author": "Lloyd Brookes <75pound@gmail.com>",
"version": "1.0.1",
"description": "Verbose request logging middleware for lws",
"version": "1.0.2",
"description": "Adds request and response logging to lws verbose output",
"repository": "https://github.com/lwsjs/request-monitor.git",

@@ -19,3 +19,4 @@ "keywords": [

"devDependencies": {
"lws": "^2.0.0-7",
"coveralls": "^3.0.3",
"lws": "^2.0.0-9",
"lws-body-parser": "^1.0.1",

@@ -22,0 +23,0 @@ "node-fetch": "^2.6.0",

@@ -10,6 +10,43 @@ [![view on npm](https://img.shields.io/npm/v/lws-request-monitor.svg)](https://www.npmjs.org/package/lws-request-monitor)

Verbose request logging middleware for [lws](https://github.com/lwsjs/lws).
Adds request and response logging to [lws](https://github.com/lwsjs/lws) verbose output.
Example command:
```
$ lws request-monitor static index --verbose
```
Example verbose output:
```js
{
'server.request': {
requestId: 1,
method: 'GET',
url: '/package-lock',
headers: {
host: '192.168.0.200:8000',
'user-agent': 'curl/7.65.0',
accept: '*/*'
}
}
}
{
'server.response': {
requestId: 1,
statusCode: 200,
headers: [Object: null prototype] {
'content-length': '27212',
'last-modified': 'Wed, 05 Jun 2019 11:59:01 GMT',
'cache-control': 'max-age=0',
'content-type': 'application/json; charset=utf-8'
},
body: [ ReadStream: /Users/lloyd/Documents/lwsjs/examples/static-index/package-lock.json ]
}
}
```
* * *
&copy; 2017-19 Lloyd Brookes \<75pound@gmail.com\>.
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