Skip to content

Response body is not coerced to JSON with :throw-exceptions false #660

@rafaritter44

Description

@rafaritter44

Shouldn't the response body be coerced to JSON in this case?

Code:

(client/get "https://openholidaysapi.org/NonExistentEndpoint"
            {:accept           :json
             :as               :json
             :throw-exceptions false})

Result:

{:cached nil,
 :request-time 996,
 :repeatable? false,
 :protocol-version {:name "HTTP", :major 1, :minor 1},
 :streaming? true,
 :http-client
 #object[org.apache.http.impl.client.InternalHttpClient 0x5732457b "org.apache.http.impl.client.InternalHttpClient@5732457b"],
 :chunked? true,
 :reason-phrase "Not Found",
 :headers
 {"Referrer-Policy" "strict-origin-when-cross-origin",
  "Server" "nginx",
  "Content-Type" "application/problem+json",
  "X-Content-Type-Options" "nosniff",
  "Permissions-Policy"
  "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=(), interest-cohort=()",
  "X-Frame-Options" "SAMEORIGIN",
  "Strict-Transport-Security" "max-age=2592000",
  "Connection" "close",
  "Transfer-Encoding" "chunked",
  "Date" "Fri, 05 Dec 2025 18:36:27 GMT",
  "Content-Security-Policy" "default-src https: data: 'unsafe-inline'"},
 :orig-content-encoding nil,
 :status 404,
 :length -1,
 :body
 "{\"type\":\"https://tools.ietf.org/html/rfc9110#section-15.5.5\",\"title\":\"Not Found\",\"status\":404,\"traceId\":\"00-4934194cfe5cd7be8e79591b07bee800-c860f67a57b12f6f-00\"}",
 :trace-redirects []}

deps.edn:

{:paths ["src"]
 :deps  {org.clojure/clojure {:mvn/version "1.12.3"}
         clj-http/clj-http   {:mvn/version "3.13.1"}
         cheshire/cheshire   {:mvn/version "6.1.0"}}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions