1.0.2 • Published 3 years ago

tidy-http v1.0.2

Weekly downloads
12
License
ISC
Repository
github
Last release
3 years ago

tidy-http

Build Status GitHub code size in bytes GitHub package.json version GitHub

The native request and response objects in node's http server contain a lot of information that is not commonly used. This library will return a new object, with only useful fields.

Installation

npm install tidy-http

Example Usage

const { tidyRequest } = require('tidy-http');

const server = http.createServer((request, response) => {
  const tidiedRequest = tidyRequest(request);

  console.log(tidiedRequest);
})

/*
{
  complete: false,
  upgrade: false,
  aborted: false,
  headers: {
    host: 'localhost:8000',
    connection: 'close'
  },
  trailers: {},
  url: '/',
  method: 'GET',
  statusCode: null,
  statusMessage: null
}
*/

License

This project is licensed under the terms of the MIT license.