4
clj-httpバージョン2.2.0を使用してRESTリソースからJSONを読み込もうとしていますが、結果を文字列として取得します。clj-httpがJSONを返さない
デバッグ中に、私は私がhttps://nym.at/test.jsonの私のウェブサーバ上の静的なJSON文書にこの要求にやってストリップダウン:
{"foo":1,"bar":"baz"}
私は名前空間にバインドされたREPL(client
で次のコードを実行します。 CLJ-http.client):
{:status 200,
:headers {"Server" "Apache/2.4.18 (Debian)",
"Upgrade" "h2,h2c",
"Content-Type" "application/json",
"Content-Length" "22",
"Strict-Transport-Security" "max-age=31536000; includeSubDomains",
"Connection" "Upgrade, close",
"Accept-Ranges" "bytes",
"ETag" "\"16-532fcf29f30c6\"",
"Date" "Mon, 16 May 2016 22:14:59 GMT",
"Last-Modified" "Mon, 16 May 2016 22:14:27 GMT"},
:body "{\"foo\":1,\"bar\":\"baz\"}\n",
:request-time 637,
:trace-redirects ["https://nym.at/test.json"],
:orig-content-encoding nil}
:
(client/get "https://nym.at/test.json" {:as :json :insecure? true})
私が得る結果は(手動印刷pritty)であります
{:as :json}
は、clj-httpがJSONとしてレスポンスを解析し、:body
にリトレースするか、ここで何か間違っていると私の予想が間違っていますか?
感謝を参照してください。チェシャーは依存関係だと思っていたので、私はドキュメントを誤解しているはずです。 –