Skip Menu |

This queue is for tickets about the REST-Client CPAN distribution.

Report information
The Basics
Id: 86617
Status: rejected
Priority: 0/
Queue: REST-Client

People
Owner: mcrawfor [...] cpan.org
Requestors: business2008 [...] rodneybeede.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 249
Fixed in: (no value)



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?
First issue: I think you might be misunderstanding the API. responseHeader is used to fetch a single header value - the name of that header is a mandatory argument. Calling it with no arguments will always fail. Second issue: If you want to see *why* you're getting a 500 error, try looking at the resource returned. This little script illustrates the troubles: http://sprunge.us/HFBT On Mon Jul 01 17:48:14 2013, rbeede wrote: Show quoted text
> 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?