1.0.2 • Published 2 years ago

@passioncloud/http v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

http

Create http request handler and http response objects.

Quick start

You can use the library to create an http response object like so:

const { HttpResponseBuilder } = require('../index.js');
const response = HttpResponseBuilder.Ok().build();

This will create below response object:

HttpResponse {
    statusCode: 200,
    headers: { 'content-type': 'application/json' },
    body: {}
}

You can also add headers and a body to your response object like so:

const response = HttpResponseBuilder.Ok()
    .addHeader('authorization': 'basic ABC')
    .setBody({ success: true })
    .build();
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago