fix README and added a simple test
This commit is contained in:
parent
17e9c6a4bc
commit
1849ba2273
2 changed files with 10 additions and 9 deletions
|
@ -31,13 +31,9 @@ Then
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
And use `wrap-open-cors` as middleware.
|
And use `wrap-open-cors` as middleware.
|
||||||
|
Now you can make AJAX call from _any_ website.
|
||||||
|
|
||||||
## Limitations
|
Of course if you want more control over which website are able to call your API, you should not use this middleware.
|
||||||
|
|
||||||
There is a bug with Safari.
|
|
||||||
The only way to make it works is by using a _very_ dirty trick:
|
|
||||||
|
|
||||||
<http://anantgarg.com/2010/02/18/cross-domain-cookies-in-safari/>
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
(:require [clojure.test :refer :all]
|
(:require [clojure.test :refer :all]
|
||||||
[fuck-cors.core :refer :all]))
|
[fuck-cors.core :refer :all]))
|
||||||
|
|
||||||
(deftest a-test
|
(def host-from-req (ns-resolve 'fuck-cors.core 'host-from-req))
|
||||||
(testing "FIXME, I fail."
|
|
||||||
(is (= 0 1))))
|
(deftest test-host-from-req
|
||||||
|
(testing "Test the get host from request"
|
||||||
|
(let [request {:headers {"host" "yannesposito.com"}
|
||||||
|
:scheme :http}]
|
||||||
|
(is (= "http://yannesposito.com"
|
||||||
|
(host-from-req request))))))
|
||||||
|
|
Loading…
Reference in a new issue