Anyone know why I might be getting 400 errors with aleph's http client, when clj-http gives a 200 response for the same request? It's just a basic get request with no params
Could be anything I guess, missing query params, authentication. Can you share the request map?
Just a basic get on a public endpoint with no params
;;clj-http works as expected:
(clj-http/get "<https://api-public.sandbox.pro.coinbase.com/products/BTC-USD/ticker>"
{:debug true
:debug-body? true
:as :json})
@(aleph-http/get "<https://api-public.sandbox.pro.coinbase.com/products/BTC-USD/ticker>"
{:debug true
:debug-body? true
:as :json})
;;=>
{:aleph/keep-alive? true,
:aleph/complete #object[manifold.deferred.SuccessDeferred
"0x7397ac1"
{:status :ready, :val false}],
:headers {"server" "cloudflare",
"content-type" "application/json; charset=utf-8",
"content-length" "44",
"connection" "keep-alive",
"cf-request-id" "05bf7ff214000091da2324c200000001",
"set-cookie" "__cfduid=d66496ec04481eff43488e02e22fcad141602524469; expires=Wed, 11-Nov-20 17:41:09 GMT; path=/; domain=.<http://sandbox.pro.coinbase.com|sandbox.pro.coinbase.com>; HttpOnly; SameSite=Lax; Secure",
"expect-ct" "max-age=604800, report-uri=\"<https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct>\"",
"cf-cache-status" "EXPIRED",
"cf-ray" "5e129c302f8691da-EWR",
"date" "Mon, 12 Oct 2020 17:41:09 GMT"},
:status 400,
:body #object[java.io.ByteArrayInputStream
"0x5d066dd"
"java.io.ByteArrayInputStream@5d066dd"]}{:aleph/keep-alive? true,
:aleph/complete #object[manifold.deferred.SuccessDeferred
"0x7397ac1"
{:status :ready, :val false}],
:headers {"server" "cloudflare",
"content-type" "application/json; charset=utf-8",
"content-length" "44",
"connection" "keep-alive",
"cf-request-id" "05bf7ff214000091da2324c200000001",
"set-cookie" "__cfduid=d66496ec04481eff43488e02e22fcad141602524469; expires=Wed, 11-Nov-20 17:41:09 GMT; path=/; domain=.<http://sandbox.pro.coinbase.com|sandbox.pro.coinbase.com>; HttpOnly; SameSite=Lax; Secure",
"expect-ct" "max-age=604800, report-uri=\"<https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct>\"",
"cf-cache-status" "EXPIRED",
"cf-ray" "5e129c302f8691da-EWR",
"date" "Mon, 12 Oct 2020 17:41:09 GMT"},
:status 400,
:body #object[java.io.ByteArrayInputStream
"0x5d066dd"
"java.io.ByteArrayInputStream@5d066dd"]}
could it be related to SSL config?
i suspect probably not ssl config, since you are getting an http 400 back. what's in that :body ByteArrayInputStream
? there might a useful error description in there...
Ah!
"{\"message\":\"User-Agent header is required.\"}"
that explains it. Thanks for the help!yw!
yes, clj-http and other libraries that try and imitate that do supply a "User-Agent" on their own. bit me when porting code from that to Aleph