0.1.2 • Published 7 months ago

@response/string v0.1.2

Weekly downloads
28
License
MIT
Repository
github
Last release
7 months 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

7 months ago

0.1.1

4 years ago