From 1849ba2273d8996ee4331f30d4a21937e7b8b927 Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Thu, 28 Jan 2016 16:09:10 +0100 Subject: [PATCH] fix README and added a simple test --- README.md | 8 ++------ test/fuck_cors/core_test.clj | 11 ++++++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d403507..454fe42 100644 --- a/README.md +++ b/README.md @@ -31,13 +31,9 @@ Then ~~~ And use `wrap-open-cors` as middleware. +Now you can make AJAX call from _any_ website. -## Limitations - -There is a bug with Safari. -The only way to make it works is by using a _very_ dirty trick: - - +Of course if you want more control over which website are able to call your API, you should not use this middleware. ## License diff --git a/test/fuck_cors/core_test.clj b/test/fuck_cors/core_test.clj index 3584aa8..24a8b23 100644 --- a/test/fuck_cors/core_test.clj +++ b/test/fuck_cors/core_test.clj @@ -2,6 +2,11 @@ (:require [clojure.test :refer :all] [fuck-cors.core :refer :all])) -(deftest a-test - (testing "FIXME, I fail." - (is (= 0 1)))) +(def host-from-req (ns-resolve 'fuck-cors.core 'host-from-req)) + +(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))))))