Liking cljdoc? Tell your friends :D

ring.middleware.cors

Ring middleware for Cross-Origin Resource Sharing.

Ring middleware for Cross-Origin Resource Sharing.
raw docstring

add-access-controlclj/s

(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.
sourceraw docstring

add-allowed-headersclj/s

(add-allowed-headers request allowed-headers response)

Adds the allowed headers to the request

Adds the allowed headers to the request
sourceraw docstring

add-headersclj/s

(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.
sourceraw docstring

allow-method?clj/s

(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.
sourceraw docstring

allow-preflight-headers?clj/s

(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.
sourceraw docstring

allow-request?clj/s

(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.
sourceraw docstring

handle-corsclj/s

(handle-cors handler request access-control response-handler)

Handle a synchronous CORS request.

Handle a synchronous CORS `request`.
sourceraw docstring

header-nameclj/s

(header-name header)

Returns the capitalized header name as a string.

Returns the capitalized header name as a string.
sourceraw docstring

lower-case-setclj/s

(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
sourceraw docstring

normalize-configclj/s

(normalize-config access-control)
source

normalize-headersclj/s

(normalize-headers headers)

Normalize the headers by converting them to capitalized strings.

Normalize the headers by converting them to capitalized strings.
sourceraw docstring

originclj/s

(origin request)

Returns the Origin request header.

Returns the Origin request header.
sourceraw docstring

parse-headersclj/s

(parse-headers s)

Transforms a comma-separated string to a set

Transforms a comma-separated string to a set
sourceraw docstring

preflight-complete-responseclj/s

The default preflight complete response.

The default preflight complete response.
sourceraw docstring

preflight?clj/s

(preflight? request)

Returns true if the request is a preflight request

Returns true if the request is a preflight request
sourceraw docstring

wrap-corsclj/s

(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])))
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close