stackerjs-http
v1.2.2
Published
[![Travis](https://img.shields.io/travis/parpeoficial/stackerjs-http.svg)](https://travis-ci.org/parpeoficial/stackerjs) [![Test Coverage](https://api.codeclimate.com/v1/badges/3ab7310303fc5193b4cf/test_coverage)](https://codeclimate.com/github/parpeofici
Downloads
14
Readme
Http
Package for managing Http requests and responses in and outside StackerJS
Usage
Response
import { Http } from "stackerjs-http";
let httpResponse = new Http.Response();
httpResponse.setContent({ status: true });
httpResponse.setContent("Everything is ok"); // or
httpResponse.setContent(new Buffer("Something")); // or
httpResponse.setStatusCode(200);
MakeRequest
new Http.MakeRequest()
.setPort(3000)
.setHeader("Authorization", "Bearer some-token")
.get("/v1/some/api", { limit: 10 }) // same for post(), put(), delete() or patch()
.then(httpResponse => {
// instance of Http.Response
let content = httpResponse.getContent();
});