Skip to content

Commit

Permalink
fixed guard let so requests without bodies are still prettyJSONed
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoughjr committed Dec 29, 2024
1 parent 55d736b commit 8c7358b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Sources/Request/Request/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,14 @@ extension AnyRequest {

let session = self.buildSession()
let request = session.request
let conf = session.configuration

guard let method = request.httpMethod,
let url = request.url,
let headers = request.allHTTPHeaderFields,
let jh = Json(headers).stringified,
let body = request.httpBody
else { return ""}
let jh = Json(headers).stringified
else { return " "}
let body = request.httpBody ?? Data()

return """
\(method.uppercased()) \(url)
Headers: \(jh)
Expand Down

0 comments on commit 8c7358b

Please sign in to comment.