debug: add request logging to APIClient
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
4dea11a48b
commit
78d2c93b41
Binary file not shown.
@ -56,10 +56,15 @@ actor APIClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let body {
|
if let body {
|
||||||
request.httpBody = try JSONEncoder().encode(AnyEncodable(body))
|
let encoded = try JSONEncoder().encode(AnyEncodable(body))
|
||||||
|
request.httpBody = encoded
|
||||||
|
print("[APIClient] \(method) \(path) bodySize=\(encoded.count)")
|
||||||
|
} else {
|
||||||
|
print("[APIClient] \(method) \(path)")
|
||||||
}
|
}
|
||||||
|
|
||||||
let (data, response) = try await session.data(for: request)
|
let (data, response) = try await session.data(for: request)
|
||||||
|
print("[APIClient] \(method) \(path) -> response received")
|
||||||
|
|
||||||
guard let httpResponse = response as? HTTPURLResponse else {
|
guard let httpResponse = response as? HTTPURLResponse else {
|
||||||
throw APIError.networkError(NSError(domain: "", code: -1))
|
throw APIError.networkError(NSError(domain: "", code: -1))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user