When an upload failed (a POST request with data in the body and the server returning a 400), there is no status code or response headers.
But its only for large data (more than 1M). For smaller data, it's work. I've digged in the source and find that when the server returns 400 before all data were sent, CFNetwork returns a kCFStreamEventErrorOccurred and from here, it's impossible to read other thing than the error in the read stream. But if the request failed after all data were sent, it send a kCFStreamEventEndEncountered and from here, status code and response readers can be read.
Hi,
When an upload failed (a POST request with data in the body and the server returning a 400), there is no status code or response headers.
But its only for large data (more than 1M). For smaller data, it's work. I've digged in the source and find that when the server returns 400 before all data were sent, CFNetwork returns a kCFStreamEventErrorOccurred and from here, it's impossible to read other thing than the error in the read stream. But if the request failed after all data were sent, it send a kCFStreamEventEndEncountered and from here, status code and response readers can be read.