diff --git a/modules/swagger-codegen/src/main/resources/clojure/core.mustache b/modules/swagger-codegen/src/main/resources/clojure/core.mustache index 79d0ee9b5e..0da2a45149 100644 --- a/modules/swagger-codegen/src/main/resources/clojure/core.mustache +++ b/modules/swagger-codegen/src/main/resources/clojure/core.mustache @@ -174,7 +174,7 @@ [mime] (if mime (or (= :json mime) - (re-matches #"application/json(;.*)?" (name mime))))) + (re-matches #"(?i)application/json(;.*)?" (name mime))))) (defn json-preferred-mime "Choose a MIME from the given MIMEs with JSON preferred, diff --git a/samples/client/petstore/clojure/src/swagger_petstore/core.clj b/samples/client/petstore/clojure/src/swagger_petstore/core.clj index 4c8a842696..665adfbc77 100644 --- a/samples/client/petstore/clojure/src/swagger_petstore/core.clj +++ b/samples/client/petstore/clojure/src/swagger_petstore/core.clj @@ -174,7 +174,7 @@ [mime] (if mime (or (= :json mime) - (re-matches #"application/json(;.*)?" (name mime))))) + (re-matches #"(?i)application/json(;.*)?" (name mime))))) (defn json-preferred-mime "Choose a MIME from the given MIMEs with JSON preferred, diff --git a/samples/client/petstore/clojure/test/swagger_petstore/core_test.clj b/samples/client/petstore/clojure/test/swagger_petstore/core_test.clj index 27a9e1db29..87ac0a8b73 100644 --- a/samples/client/petstore/clojure/test/swagger_petstore/core_test.clj +++ b/samples/client/petstore/clojure/test/swagger_petstore/core_test.clj @@ -151,10 +151,12 @@ (is (= expected (boolean (json-mime? mime)))) :json true "application/json" true + "APPLICATION/JSON" true "application/json; charset=utf8" true nil false :xml false - "application/pdf" false)) + "application/pdf" false + "application/jsonp" false)) (deftest test-json-preferred-mime (are [mimes expected] @@ -177,4 +179,4 @@ "{\"aa\": 1, \"bb\": \"2\"}" "application/json" {:aa 1 :bb "2"} "[1, \"2\"]" "application/json; charset=UTF8" [1 "2"] "{invalid json}" "application/json" "{invalid json}" - "plain text" "text/plain" "plain text")) \ No newline at end of file + "plain text" "text/plain" "plain text"))