navigation

PipelineHelpers

Namespace: Saturn
Parent: Saturn

Module containing helper functions that can be used with pipeline computation expression


Values and Functions
Name Description
acceptJson
Signature: HttpHandler

Accepts application/json

acceptXml
Signature: HttpHandler

Accepts application/xml

acceptHtml
Signature: HttpHandler

Accepts text/html

acceptMultipart
Signature: HttpHandler

Accepts multipart/form-data

putSecureBrowserHeaders
Signature: HttpHandler

Put headers that improve browser security. It sets the following headers: x-frame-options - set to SAMEORIGIN to avoid clickjacking through iframes unless in the same origin x-content-type-options - set to nosniff. This requires script and style tags to be sent with proper content type x-xss-protection - set to "1; mode=block" to improve XSS protection on both Chrome and IE x-download-options - set to noopen to instruct the browser not to open a download directly in the browser, to avoid HTML files rendering inline and accessing the security context of the application (like critical domain cookies) * x-permitted-cross-domain-policies - set to none to restrict Adobe Flash Player’s access to data

protectFromForgery
Signature: HttpHandler

Enables CSRF protection using the (required) Antiforgery feature. This feature can be set up via the use_antiforgery or use_antiforgery_with_config operations on the application builder. This feature requires that one of those be used (or some other mechanism of initializing the Antiforgery/Data Protection subsystems has been performed out-of-band)

enableCors(config)
Signature: config:CORSConfig -> HttpHandler

Enables CORS pretection using provided config. Use CORS.defaultCORSConfig for default configuration.

fetchSession nxt ctx
Signature: nxt:HttpFunc -> ctx:HttpContext -> HttpFuncResult

Fetches session from session provider. If it won't be called session will be synchronusly fetched on first usage.

fetchModel culture nxt ctx
Signature: culture:string option -> nxt:HttpFunc -> ctx:HttpContext -> HttpFuncResult

Tries to model from request and puts model into Items.RequestModel. If it won't be called content can be fetched using Context.Controller helpers. It optionally takes custom culture name as arguments.

head nxt ctx

Convert HEAD requests to GET requests.

requestId nxt ctx
Signature: nxt:HttpFunc -> ctx:HttpContext -> HttpFuncResult

Pipeline for generating a unique request id for each request. A generated request id will in the format uq8hs30oafhj5vve8ji5pmp7mtopc08f. If a request id already exists as the x-request-id HTTP request header, then that value will be used assuming it is between 20 and 200 characters. If it is not, a new request id will be generated. Request id is put into x-request-id HTTP header and into Items directory of HttpContext with RequestId key.

requireHeader header value nxt ctx
Signature: header:string -> value:string -> nxt:HttpFunc -> ctx:HttpContext -> HttpFuncResult

Requires given value for given request header