Subject: | responseHeader throws exception if never connected |
When calling in my code:
print STDERR "Response Header:\t" . $restClient->responseHeader() . "\n";
I get the following exception:
REST::Client exception: no header provided to responseHeader
This occurs if I failed to make a connection. Because $restClient->responseCode() returns a 501 error number I cannot tell if the remote server returned the 501 or if it failed locally.
For timeouts or other failures where the remote server was never contacted their should be a way to know without having to call $restClient->responseHeader() and try catch an exception.
Perhaps the error code could be in the 1000 range for $restClient->responseCode() when the client never connected to the remote server? That is outside of what the HTTP spec currently defines or perhaps a negative number?