Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
handles empty strings in headers
Browse files Browse the repository at this point in the history
  • Loading branch information
shamsimam committed May 4, 2018
1 parent cba3b1b commit 1122a9b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion token-syncer/integration/token_syncer/basic_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
;; ASSERT
(let [waiter-sync-result (constantly
{:code :success/hard-delete
:details {:etag token-etag
:details {:etag (str token-etag)
:status 200}})
expected-result {:details {token-name {:latest {:cluster-url (first waiter-urls)
:description token-description
Expand Down
2 changes: 1 addition & 1 deletion waiter/integration/waiter/basic_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
(is (get-in body-json ["headers" "authorization"]) (str body))
(is (get-in body-json ["headers" "x-waiter-auth-principal"]) (str body))
(is (get-in body-json ["headers" "x-cid"]) (str body))
(is (nil? (get-in body-json ["headers" "content-type"])) (str body))
(is (str/blank? (get-in body-json ["headers" "content-type"])) (str body))
(is (= "0" (get-in body-json ["headers" "content-length"])) (str body))
(is (= "text/plain" (get-in body-json ["headers" "accept"])) (str body))))

Expand Down
3 changes: 2 additions & 1 deletion waiter/src/waiter/mesos/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
(ns waiter.mesos.utils
(:require [clojure.core.async :as async]
[clojure.data.json :as json]
[clojure.string :as str]
[clojure.walk :as walk]
[qbits.jet.client.http :as http]
[slingshot.slingshot :as ss]
Expand All @@ -33,7 +34,7 @@
spnego-auth (assoc :auth (spnego/spnego-authentication (URI. request-url)))
accept (assoc :accept accept)
body (assoc :body body)
content-type (assoc :content-type content-type)
(not (str/blank? content-type)) (assoc :content-type content-type)
(seq headers) (assoc :headers headers)
query-string (assoc :query-string query-string))
raw-response (http/request http-client request-map)
Expand Down
2 changes: 1 addition & 1 deletion waiter/src/waiter/token.clj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"Validates whether the token modification should be allowed on based on the provided token version-hash."
[{:keys [token-metadata] :as token-description} version-hash]
(when version-hash
(when (not= (token-description->token-hash token-description) (str version-hash))
(when (not= (str (token-description->token-hash token-description)) (str version-hash))
(throw (ex-info "Cannot modify stale token"
{:provided-version version-hash
:status 412
Expand Down
2 changes: 1 addition & 1 deletion waiter/src/waiter/util/client_tools.clj
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
multipart (assoc :multipart multipart)
add-spnego-auth (assoc :auth (spnego/spnego-authentication (URI. request-url)))
form-params (assoc :form-params form-params)
content-type (assoc :content-type content-type)
(not (str/blank? content-type)) (assoc :content-type content-type)
cookies (assoc :cookies (map (fn [c] [(:name c) (:value c)]) cookies)))))
response-body (if body (async/<!! body) nil)]
(when verbose
Expand Down

0 comments on commit 1122a9b

Please sign in to comment.