The current UrlLoader behavior seems to be not to fill in event.data if the request fails. Some of the REST apis provide useful error messages when they fail (e.g., "invalid user id"). So .. would it be possible to fill in event.data on failed requests?
Comments
UrlLoader downloads (but ignores) the data if the header is not "200 OK".
For example, test.php:
BTW, to be able to use any protocol, if the first bytes received are not a standard HTTP response then event.httpResponse = nil and event.data = all_data_received
(If the 5 first bytes received are not "HTTP/" then it's not the HTTP protocol).
The format of the HTTP protocol is (response(header/s) + data):
HTTP/[...][line_break] // header
[...more headers...]
[line_break] // extra line break (empty line) indicates the end of the HTTP response
[now starts the data section until the end of the transfer]
Note: line_break can be CRLF, CR or LF