raw-http-response
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

raw-http-response

A small package that generates a raw HTTP response from an object

Usage

The function takes a RawResponse object and returns a Node Buffer, that can be later simply stringified or base64'd, to work with binary data.

import buildHttpResponse from 'raw-http-response';
 
const buffer = buildHttpResponse({
  status: 200,
  headers: { "Content-Type": "application/json" },
  body: Buffer.from(
    JSON.stringify({ hello: "world" })
  )
});

Readme

Keywords

Package Sidebar

Install

npm i raw-http-response

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.61 kB

Total Files

5

Last publish

Collaborators

  • arielh
  • falconci
  • yurynix
  • itai.benda
  • wix-ci
  • wix-ambassador
  • shahata
  • netanelgilad
  • wix-ci-publisher
  • wix-bi-publisher