Constructs a new Response object with the given status code, body, and optional behavior.
The HTTP status code of the response.
The body of the response.
Optional
optBehaviour: { Optional behavior configuration for the response.
Optional
disableOptional
rawIndicates whether the response body should be treated as raw data.
Optional
shouldIndicates whether the response should be streamed.
Optional
throwIndicates whether errors should be thrown for non-successful status codes.
Readonly
disableIndicates whether the transaction ID is disabled.
Readonly
rawIndicates whether the request body should be treated as raw data.
Readonly
shouldDetermines whether streaming is enabled or not.
Readonly
throwA boolean flag indicating whether to throw an error when encountering errors. If set to true, any errors encountered will result in an exception being thrown. If set to false, errors will be logged but the program will continue execution.
Builds the response for the given context and transaction.
The context object.
The transaction object.
Optional flag to indicate whether to call the context or not.
Static
BadCreates a BadRequestResponse object with the given parameters.
Optional
msg: stringThe error message.
Optional
errCode: stringThe error code.
Optional
optBody: anyOptional additional body data.
Static
BadCreates a BadRequestResponse object with rollback option.
The error message.
Optional
errCode: stringThe error code.
Optional
optBody: anyOptional body to include in the response.
Static
MissingGenerates a response object for a missing path parameter error.
The name of the missing path parameter.
Static
MissingCreates a response object for a missing query parameter error.
The name of the missing query parameter.
Static
RedirectStatic
SimpleCreates a simple HTTP response with the given body and optional status code.
The body of the response.
Optional
optionalCode: numberThe optional status code of the response. Defaults to 200.
Static
StepStatic
SuccessStatic
SuccessStatic
SuccessCreates a success response object with a streaming body and specified content type.
The stream object to be used as the response body.
The content type of the response.
Static
UnauthorizedCreates an unauthorized response with the given error message and error code.
The error message.
Optional
errCode: stringThe error code (optional).
Represents a response object with various methods for building and manipulating the response.