responselike

WebJar for responselike

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

responselike
Последняя версия

Последняя версия

2.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

responselike
WebJar for responselike
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/lukechilds/responselike

Скачать responselike

Как подключить последнюю версию

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

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : lowercase-keys jar [2.0.0,3)

Модули Проекта

Данный проект не имеет модулей.

responselike

A response-like object for mocking a Node.js HTTP response stream

Build Status Coverage Status npm npm

Returns a streamable response object similar to a Node.js HTTP response stream. Useful for formatting cached responses so they can be consumed by code expecting a real response.

Install

npm install --save responselike

Or if you're just using for testing you'll want:

npm install --save-dev responselike

Usage

const Response = require('responselike');

const response = new Response(200, { foo: 'bar' }, Buffer.from('Hi!'), 'https://example.com');

response.statusCode;
// 200
response.headers;
// { foo: 'bar' }
response.body;
// <Buffer 48 69 21>
response.url;
// 'https://example.com'

response.pipe(process.stdout);
// Hi!

API

new Response(statusCode, headers, body, url)

Returns a streamable response object similar to a Node.js HTTP response stream.

statusCode

Type: number

HTTP response status code.

headers

Type: object

HTTP headers object. Keys will be automatically lowercased.

body

Type: buffer

A Buffer containing the response body. The Buffer contents will be streamable but is also exposed directly as response.body.

url

Type: string

Request URL string.

License

MIT © Luke Childs

Версии библиотеки

Версия
2.0.0
1.0.2