Skip to content

api.service.LocalClientResponse ​

This service implements the description of a response combined with an instance of LocalClientRequest on locally dispatching requests.

Example ​

javascript
const response = await request.dispatch();

if ( response.statusCode === 200 ) {
    const body = await response.body();
	const data = JSON.parse( body.toString( "utf8" ) );

    // TODO: process response
}

Properties ​

headers ​

This property provides all response headers with their names always converted to lowercase.

statusCode ​

This property exposes the HTTP status code the handled request would have yield when sent to the local Hitchy runtime via HTTP.

Methods ​

body() ​

This method fetches the response body and promises it as a Buffer.