Generate http request message
npm i http-raw-request
Script:
const httpRawRequest = require('http-raw-request');
const params = {
httpVersion: '1.1',
method: 'POST',
url: '/'
};
const headers = { Host: 'localhost' };
const body = 'Hello world'
const request = httpRawRequest(params, headers, body);
HTTP Request:
POST / HTTP/1.1
Host: localhost
User-Agent: User-Agent
Hello world
npm run test
MIT © nlapshin