Skip to content

Commit

Permalink
Content-length on req is long; content-length in header is a String, …
Browse files Browse the repository at this point in the history
…per Ring spec
  • Loading branch information
ohpauleez committed Dec 18, 2015
1 parent e0cff55 commit c1dcb53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion service/src/io/pedestal/http/impl/servlet_interceptor.clj
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
(if (neg? c)
req-map
(-> (assoc! req-map :content-length c)
(assoc! :headers (assoc headers "content-length" c))))))
(assoc! :headers (assoc headers "content-length" (str c)))))))

(defn- add-character-encoding [req-map ^HttpServletRequest servlet-req]
(if-let [e (.getCharacterEncoding servlet-req)]
Expand Down
4 changes: 2 additions & 2 deletions service/src/io/pedestal/test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@
(getHeaderNames [this] (enumerator (keys (get options :headers)) ::getHeaderNames))
(getHeader [this header] (get-in options [:headers header]))
;;(getHeaders [this header] (enumerator (get-in options [:headers header]) ::getHeaders))
(getContentLength [this] (get-in options [:headers "Content-Length"] (int 0)))
(getContentLengthLong [this] (get-in options [:headers "Content-Length"] (long 0)))
(getContentLength [this] (Integer/parseInt (get-in options [:headers "Content-Length"] "0")))
(getContentLengthLong [this] (Long/parseLong (get-in options [:headers "Content-Length"] "0")))
(getContentType [this] (get-in options [:headers "Content-Type"] ""))
(getCharacterEncoding [this] "UTF-8")
(setAttribute [this s obj] nil) ;; Needed for NIO testing (see Servlet Interceptor)
Expand Down

0 comments on commit c1dcb53

Please sign in to comment.