@plant/test-http

0.5.3 • Public • Published

Plant Test HTTP Suite

This is a very simple test servers made for Plant development.

Install

npm i @plant/test-http

Usage

const {createHttp} = require('@plant/test-http')
// or
const createHttp = require('@plant/test-http/http')

const server = createHttp((req, res) => {
  res.end('Hello')
})

server.listen(0)

server.fetch('/index.html')
.then(({status, headers, body, text}) => {
  body.toString('utf8') === text; // true
})

API

  • createHttp() – create HTTP test server
  • createHttp2() – create HTTP2 test server
  • createHttps() – create HTTPS test server
  • createHttps2() – create HTTPS2 test server (the same as http2, but with HTTP2 test options)
  • fetchHttp() – fetch HTTP resource using promisified API.
  • fetchHttp2() – fetch HTTP2 resource using promisified API.
  • fetchHttps() – fetch HTTPS resource using promisified API.

Copyright

MIT © Rumkin

Package Sidebar

Install

npm i @plant/test-http

Weekly Downloads

0

Version

0.5.3

License

MIT

Unpacked Size

17.8 kB

Total Files

17

Last publish

Collaborators

  • rumkin