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

(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

(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

(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

(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

(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

(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

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

header-nameclj

(header-name header)

Returns the capitalized header name as a string.

Returns the capitalized header name as a string.
sourceraw docstring

lower-case-setclj

(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

(normalize-config access-control)
source

normalize-headersclj

(normalize-headers headers)

Normalize the headers by converting them to capitalized strings.

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

originclj

(origin request)

Returns the Origin request header.

Returns the Origin request header.
sourceraw docstring

parse-headersclj

(parse-headers s)

Transforms a comma-separated string to a set

Transforms a comma-separated string to a set
sourceraw docstring

preflight?clj

(preflight? request)

Returns true if the request is a preflight request

Returns true if the request is a preflight request
sourceraw docstring

wrap-corsclj

(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