Ring middleware for Cross-Origin Resource Sharing.
Ring middleware for Cross-Origin Resource Sharing.
(add-access-control request access-control response)
Add the access-control headers to the response based on the rules and what came on the header.
Add the access-control headers to the response based on the rules and what came on the header.
(add-allowed-headers request allowed-headers response)
Adds the allowed headers to the request
Adds the allowed headers to the request
(add-headers request access-control response)
Add the access control headers using the request's origin to the response.
Add the access control headers using the request's origin to the response.
(allow-method? request allowed-methods)
In the case of regular requests it checks if the request-method is allowed. In the case of preflight requests it checks if the access-control-request-method is allowed.
In the case of regular requests it checks if the request-method is allowed. In the case of preflight requests it checks if the access-control-request-method is allowed.
(allow-preflight-headers? request allowed-headers)
Returns true if the request is a preflight request and all the headers that it's going to use are allowed. Returns false otherwise.
Returns true if the request is a preflight request and all the headers that it's going to use are allowed. Returns false otherwise.
(allow-request? request access-control)
Returns true if the request's origin matches the access control origin, otherwise false.
Returns true if the request's origin matches the access control origin, otherwise false.
(handle-cors handler request access-control response-handler)
Handle a synchronous CORS request
.
Handle a synchronous CORS `request`.
(header-name header)
Returns the capitalized header name as a string.
Returns the capitalized header name as a string.
(lower-case-set s)
Converts strings in a sequence to lower-case, and put them into a set
Converts strings in a sequence to lower-case, and put them into a set
(normalize-headers headers)
Normalize the headers by converting them to capitalized strings.
Normalize the headers by converting them to capitalized strings.
(origin request)
Returns the Origin request header.
Returns the Origin request header.
(parse-headers s)
Transforms a comma-separated string to a set
Transforms a comma-separated string to a set
The default preflight complete response.
The default preflight complete response.
(preflight? request)
Returns true if the request is a preflight request
Returns true if the request is a preflight request
(wrap-cors handler & access-control)
Middleware that adds Cross-Origin Resource Sharing headers.
(def handler (-> routes (wrap-cors :access-control-allow-origin #"http://example.com" :access-control-allow-methods [:get :put :post :delete])))
Middleware that adds Cross-Origin Resource Sharing headers. (def handler (-> routes (wrap-cors :access-control-allow-origin #"http://example.com" :access-control-allow-methods [:get :put :post :delete])))
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close