2017-03-29 3 views
1

요청에 :query-params을 포함하는 with-fake-http 요격을 어떻게 할 수 있습니까? . 사용할 수 없습니다 등록되지 않은 URL localhost를 실제 HTTP 요청을 GET 수행하려고 컴파일 : (웹/db_test.clj : 57 : 1 다음 코드는 예외httpkit-fake는 전달 된 매개 변수를 사용하여 URL 빌드를 가로 채지 않습니다.

(require                                                                  
      '[org.httpkit.client :as http]                                                          
      '[org.httpkit.fake :refer :all]                                                          
      )  


(with-fake-http ["localhost?q=hello" "hello param"]                                                        
    (println @(http/get "localhost" :query-params {:q "hello"}))) 

CompilerException java.lang.IllegalArgumentException가 생산)

도움 주셔서 감사합니다. 대신 문자열 "localhost?q=hello"

답변

2

, 당신은 키와지도를 제공 할 수 :url:query-params

(with-fake-http 
    [{:query-params {:q "hello"}, :url "localhost"} "hello param"] 
    (println @(http/get "localhost" {:query-params {:q "hello"}})))