Script unit that provides methods useful when writing REST services.
| Methods |
|---|
function emptyResponse(status: int): rest_response Creates a response without a body. |
function responseOf(status: int, content: any): rest_response Creates a JSON response with an optional HTTP status. |
function emptyResponse(status: int): rest_response
Creates a response without a body.
Parameters:
status: the status code. If null, 204 is assumed.
Return:
the response.
Can be used in:
function responseOf(status: int, content: any): rest_response
Creates a JSON response with an optional HTTP status.
Parameters:
status: the status code. If null, 200 is assumed.
content: the content to serialize. Supports typed objects from JSON schemas, generic json_value, and lists (including multi-dimensional) of these types. If null, the body is the JSON value null.
Return:
the JSON response.
Can be used in: