0.1.2 • Published 2 years ago

@response/string v0.1.2

Weekly downloads
28
License
MIT
Repository
github
Last release
2 years ago

String Response

A class representing a raw response backed by a string.

Installation

npm install @response/string

Usage

const string = require('@response/string')
const http = require('http')

http.createServer((req, res) => {
  // Status 200, type text/plain
  string('Hello,World').write(res)

  // Status 200, type text/plain
  string(200, 'Hello,World').write(res)

  // Status 200, type text/csv
  string(200, 'Hello,World', { 'Content-Type': 'text/csv' }).write(res)
})

Mutable Properties

  • statusCode: number - The status code
  • headers: object - The custom headers
  • data: string - The raw data
0.1.2

2 years ago

0.1.1

5 years ago