File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 346346(defn  coerce-clojure-body 
347347  [request {:keys  [body] :as  resp}]
348348  (let  [^String charset (or  (->  resp :content-type-params  :charset ) " UTF-8"  )
349-         body (util/force-byte-array  body)]
350-     (if  edn-enabled?
351-       (assoc  resp :body  (parse-edn  (String.  ^" [B"   body charset)))
352-       (binding  [*read-eval* false ]
353-         (assoc  resp :body  (read-string  (String.  ^" [B"   body charset)))))))
349+         body            (util/force-byte-array  body)]
350+     (assoc  resp :body  (cond 
351+                         (empty?  body) nil 
352+                         edn-enabled? (parse-edn  (String.  ^" [B"   body charset))
353+                         :else  (binding  [*read-eval* false ]
354+                                 (read-string  (String.  ^" [B"   body charset)))))))
354355
355356(defn  coerce-transit-body 
356357  [{:keys  [transit-opts] :as  request} {:keys  [body] :as  resp} type]
Original file line number Diff line number Diff line change 565565  (run-server )
566566  (client/request  {:method  :get  :url  (localhost  " /get"  ) :headers  {" foo"   2 }}))
567567
568- ; ; Currently failing, see: https://github.com/dakrone/clj-http/issues/257
569- ; ; (deftest ^:integration t-empty-response-coercion
570- ; ;   (run-server)
571- ; ;   (let [resp (client/get (localhost "/empty") {:as :clojure})]
572- ; ;     (is (= (:body resp) ""))))
568+ (deftest  ^:integration t-empty-response-coercion 
569+    (run-server )
570+    (let  [resp (client/get  (localhost  " /empty"  ) {:as  :clojure })]
571+      (is  (=  (:body  resp) nil ))))
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments