Context
Descriptive full API of a Context.
Last updated
Descriptive full API of a Context.
Last updated
A part of the context method is linked to the default provided by Idylle. Specific method are design to adapt HTTP code when responding to an HTTP Request. For a better understanding feel free to check the .
context.ok(resource) -> resource
changes the state of the context to tell the default ResponseHandler
that the response should be a 200 OK.
context.created(resource) -> resource
changes the state of the context to tell the default ResponseHandler
that the response should be a 201 Created and let the response body empty.
context.partial(resource) -> resource
changes the state of the context to tell the default ResponseHandler
that the response should be a 206 Partial.
context.redirect(code, url) -> void
changes the state of the context to tell the default ResponseHandler
that the response should be a 301 Moved Permanently. Generally used when a deprecated method is still called from an old client.
context.stream(path | buffer) -> void
changes the state of the context to tell the default ResponseHandler
that a File
or Buffer
has to be downloaded from the given path.
context.noContent(resource) -> resource
changes the state of the context to tell the default ResponseHandler
that the response should be a 204 No Content and let the response body empty.
.error(code, message, ...args) -> Promise (rejected)
create a rejection with a