(acceptable-content-type candidate header)
Returns a boolean indicating whether the candidate
mime type
matches any of those listed in header
, an Accept header.
Returns a boolean indicating whether the `candidate` mime type matches any of those listed in `header`, an Accept header.
(sanitize-client-cert req)
Given a ring request, return a map which replaces the :ssl-client-cert with just the certificate's Common Name at :ssl-client-cert-cn. Also, remove the copy of the certificate put on the request by TK-auth.
Given a ring request, return a map which replaces the :ssl-client-cert with just the certificate's Common Name at :ssl-client-cert-cn. Also, remove the copy of the certificate put on the request by TK-auth.
(wrap-accepts-content-type handler content-type)
Ring middleware that requires a request for the wrapped handler
to accept the
provided content-type
. If the content type isn't acceptable, a 406 Not
Acceptable status is returned, with a message informing the client it must
accept the content type.
Ring middleware that requires a request for the wrapped `handler` to accept the provided `content-type`. If the content type isn't acceptable, a 406 Not Acceptable status is returned, with a message informing the client it must accept the content type.
Ring middleware which requires a request for handler
to accept
application/json as a content type. If the request doesn't accept
application/json, a 406 Not Acceptable status is returned with an error
message indicating the problem.
Ring middleware which requires a request for `handler` to accept application/json as a content type. If the request doesn't accept application/json, a 406 Not Acceptable status is returned with an error message indicating the problem.
(wrap-add-cache-headers handler)
Inputs: [handler :- IFn] Returns: IFn
Adds cache control invalidation headers to GET and PUT requests if they are handled by the handler
Inputs: [handler :- IFn] Returns: IFn Adds cache control invalidation headers to GET and PUT requests if they are handled by the handler
(wrap-add-csp handler csp-val)
Inputs: [handler :- IFn csp-val] Returns: IFn
Adds 'Content-Security-Policy: default-src 'self'' headers to request.
Inputs: [handler :- IFn csp-val] Returns: IFn Adds 'Content-Security-Policy: default-src 'self'' headers to request.
(wrap-add-referrer-policy policy-option handler)
Inputs: [policy-option :- schema/Str handler :- IFn] Returns: IFn
Adds referrer policy to the header as 'Referrer-Policy: no-referrer' or 'Referrer-Policy: same-origin'
Inputs: [policy-option :- schema/Str handler :- IFn] Returns: IFn Adds referrer policy to the header as 'Referrer-Policy: no-referrer' or 'Referrer-Policy: same-origin'
(wrap-add-x-content-nosniff handler)
Inputs: [handler :- IFn] Returns: IFn
Adds 'X-Content-Type-Options: nosniff' headers to request.
Inputs: [handler :- IFn] Returns: IFn Adds 'X-Content-Type-Options: nosniff' headers to request.
(wrap-add-x-frame-options-deny handler)
Inputs: [handler :- IFn] Returns: IFn
Adds 'X-Frame-Options: DENY' headers to requests if they are handled by the handler
Inputs: [handler :- IFn] Returns: IFn Adds 'X-Frame-Options: DENY' headers to requests if they are handled by the handler
(wrap-bad-request handler)
(wrap-bad-request handler type)
Inputs: ([handler :- IFn] [handler :- IFn type :- utils/ResponseType]) Returns: IFn
A ring middleware that catches slingshot errors thrown by utils/throw-bad-request!, logs the error and returns a BadRequest ring response.
Inputs: ([handler :- IFn] [handler :- IFn type :- utils/ResponseType]) Returns: IFn A ring middleware that catches slingshot errors thrown by utils/throw-bad-request!, logs the error and returns a BadRequest ring response.
(wrap-content-type handler content-types)
Verification for the specified list of content-types.
Verification for the specified list of content-types.
Ring middleware which requires a request for handler
to accept
application/json as a content-type. If the request doesn't specify
a content-type of application/json a 415 Unsupported Type status is returned.
Ring middleware which requires a request for `handler` to accept application/json as a content-type. If the request doesn't specify a content-type of application/json a 415 Unsupported Type status is returned.
(wrap-data-errors handler)
(wrap-data-errors handler type)
Inputs: ([handler :- IFn] [handler :- IFn type :- utils/ResponseType]) Returns: IFn
A ring middleware that catches a slingshot error thrown by throw-data-invalid! or a :kind of slingshot error of one of: :request-data-invalid :user-data-invalid :data-invalid :service-status-version-not-found logs the error and returns a BadRequest ring response.
Inputs: ([handler :- IFn] [handler :- IFn type :- utils/ResponseType]) Returns: IFn A ring middleware that catches a slingshot error thrown by throw-data-invalid! or a :kind of slingshot error of one of: :request-data-invalid :user-data-invalid :data-invalid :service-status-version-not-found logs the error and returns a BadRequest ring response.
Ring middleware which catches JsonParseExceptions and returns a predictable result
Ring middleware which catches JsonParseExceptions and returns a predictable result
(wrap-proxy handler proxied-path remote-uri-base & [http-opts])
Inputs: [handler :- IFn proxied-path :- (schema/either Pattern schema/Str) remote-uri-base :- schema/Str & [http-opts]] Returns: IFn
Proxies requests to proxied-path, a local URI, to the remote URI at remote-uri-base, also a string.
Inputs: [handler :- IFn proxied-path :- (schema/either Pattern schema/Str) remote-uri-base :- schema/Str & [http-opts]] Returns: IFn Proxies requests to proxied-path, a local URI, to the remote URI at remote-uri-base, also a string.
(wrap-request-logging handler)
Inputs: [handler :- IFn] Returns: IFn
A ring middleware that logs the request.
Inputs: [handler :- IFn] Returns: IFn A ring middleware that logs the request.
(wrap-response-logging handler)
Inputs: [handler :- IFn] Returns: IFn
A ring middleware that logs the response.
Inputs: [handler :- IFn] Returns: IFn A ring middleware that logs the response.
(wrap-schema-errors handler)
(wrap-schema-errors handler type)
Inputs: ([handler :- IFn] [handler :- IFn type :- utils/ResponseType]) Returns: IFn
A ring middleware that catches schema errors and returns a InternalServiceError response with the details
Inputs: ([handler :- IFn] [handler :- IFn type :- utils/ResponseType]) Returns: IFn A ring middleware that catches schema errors and returns a InternalServiceError response with the details
(wrap-service-unavailable handler)
(wrap-service-unavailable handler type)
Inputs: ([handler :- IFn] [handler :- IFn type :- utils/ResponseType]) Returns: IFn
A ring middleware that catches slingshot errors thrown by utils/throw-service-unavailabe!, logs the error and returns a ServiceUnavailable ring response.
Inputs: ([handler :- IFn] [handler :- IFn type :- utils/ResponseType]) Returns: IFn A ring middleware that catches slingshot errors thrown by utils/throw-service-unavailabe!, logs the error and returns a ServiceUnavailable ring response.
(wrap-uncaught-errors handler)
(wrap-uncaught-errors handler type)
Inputs: ([handler :- IFn] [handler :- IFn type :- utils/ResponseType]) Returns: IFn
A ring middleware that catches all otherwise uncaught errors and returns a InternalServiceError response with the error message
Inputs: ([handler :- IFn] [handler :- IFn type :- utils/ResponseType]) Returns: IFn A ring middleware that catches all otherwise uncaught errors and returns a InternalServiceError response with the error message
(wrap-with-certificate-cn handler)
Inputs: [handler :- IFn] Returns: IFn
Ring middleware that will annotate the request with an :ssl-client-cn key representing the CN contained in the client certificate of the request. If no client certificate is present, the key's value is set to nil.
Inputs: [handler :- IFn] Returns: IFn Ring middleware that will annotate the request with an :ssl-client-cn key representing the CN contained in the client certificate of the request. If no client certificate is present, the key's value is set to nil.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close