added aggressive preflight middleware
This commit is contained in:
parent
82a0e3ad86
commit
17e9c6a4bc
2 changed files with 12 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
(defproject fuck-cors "0.1.5"
|
||||
(defproject fuck-cors "0.1.6"
|
||||
:description "Fuck CORS and open all to everyone"
|
||||
:url "http://github.com/yogsototh/fuck-cors"
|
||||
:license {:name "MIT"
|
||||
|
|
|
@ -33,3 +33,14 @@
|
|||
"Vary" "Accept-Encoding, Origin, Accept-Language"}]
|
||||
(-> (handler request)
|
||||
(update-in [:headers] #(into % headers))))))
|
||||
|
||||
(defn wrap-preflight
|
||||
"Add a preflight answer. Will break any OPTIONS handler, beware.
|
||||
To put AFTER wrap-open-cors"
|
||||
[handler]
|
||||
(fn [request]
|
||||
(if (= (request :request-method) :options)
|
||||
(into request {:status 200 :body "preflight complete"})
|
||||
(handler request))))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue