To make a network request, I'm using:
session.dataTask(with: urlRequest) { data, response, error in...
I'm trying to specifically handle different cases of getting a 400 response from the server. Meaning, I'm purposely trying to have failing requests, whose responses are 400 errors. error is nil, as expected.
The data passed into the closure is always empty, and response.status.localizedDescription just says "bad request".
On the backend, we're able to see which error was actually thrown, but not on the client.
How can I see the details of the failed request's response? For example, "Bad Request: email is already in use".
Happy to expand or clarify as needed.