http-response-object

WebJar for http-response-object

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

http-response-object
Last Version

Last Version

3.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

http-response-object
WebJar for http-response-object
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/ForbesLindesay/http-response-object

Download http-response-object

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/http-response-object/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>http-response-object</artifactId>
    <version>3.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/http-response-object/
implementation 'org.webjars.npm:http-response-object:3.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/http-response-object/
implementation ("org.webjars.npm:http-response-object:3.0.2")
'org.webjars.npm:http-response-object:jar:3.0.2'
<dependency org="org.webjars.npm" name="http-response-object" rev="3.0.2">
  <artifact name="http-response-object" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='http-response-object', version='3.0.2')
)
libraryDependencies += "org.webjars.npm" % "http-response-object" % "3.0.2"
[org.webjars.npm/http-response-object "3.0.2"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : types__node jar [10.0.3,11)

Project Modules

There are no modules declared in this project.

http-response-object

A simple object to represent an http response (with flow and typescript types)

Build Status Dependency Status NPM version

Installation

npm install http-response-object

Usage

var Response = require('http-response-object');
var res = new Response(200, {}, new Buffer('A ok'), 'http://example.com');
//res.statusCode === 200
//res.headers === {}
//res.body === new Buffer('A ok')
//res.url === 'http://example.com'
res.getBody();
// => new Buffer('A ok')

var res = new Response(404, {'Header': 'value'}, new Buffer('Wheres this page'), 'http://example.com');
//res.statusCode === 404
//res.headers === {header: 'value'}
//res.body === new Buffer('Wheres this page')
//res.url === 'http://example.com'
res.getBody();
// => throws error with `statusCode`, `headers`, `body` and `url` properties copied from the response

Properties

  • statusCode: Number - the status code of the response
  • headers: Object - the headers of the response. The keys are automatically made lower case.
  • body: Buffer | String - the body of the response. Should be a buffer on the server side, but may be a simple string for lighter weight clients.
  • url: String - the url that was requested. If there were redirects, this should be the last url to get requested.

License

MIT

Versions

Version
3.0.2
2.0.3