Response

Response API.

Used as a response (answer) for the request.

Methods

Response has the following parameters:

Method

Description

success()

Returns successful response without body.

success(body)

Returns successful response with specified body.

success(body, mimeType)

Returns successful response with specified body and MIME type.

binary(body)

Returns successful response with binary data in body and MIME type “application/octet-stream.”

binary(body, mimeType)

Returns successful response with binary data in body and specified MIME type.

redirect(url)

Returns redirect response with specified location URL.

error(body)

Returns error response with specified body and error code (response status).

setHeader(name, value)

Sets specified header value.