Constructs and returns the raw response.
The respond method generates and returns the raw response based on
the provided options. The response is returned as-is, allowing for
maximum flexibility in defining its structure.
A RawResponse object containing the response options.
StaticcreateFactory method to create an instance of RawResponseWrapper.
This method initializes the wrapper with a set of partial response options.
Partial options to configure the raw response.
A new instance of RawResponseWrapper.
const responseWrapper = RawResponseWrapper.create({
headers: { 'Content-Type': 'application/json' },
body: { message: 'Success' },
statusCode: 200,
});
const response = responseWrapper.respond();
console.log(response); // { headers: { 'Content-Type': 'application/json' }, body: { message: 'Success' }, statusCode: 200 }
Wrapper for generic raw responses.
The
RawResponseWrapperis responsible for encapsulating a raw response and returning it in a structure that aligns with the Stone.js framework's requirements. It implements theIRawResponseWrapperinterface, ensuring compatibility with the framework.