[PEAR-BUG] Req #18745 [Opn->WFx]: optionally throw exception when HTTP error status code sent

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=18745&edit=1

 ID:               18745
 Updated by:       [email protected]
 Reported By:      rico dot sonntag at netresearch dot de
 Summary:          optionally throw exception when HTTP error status
                    code sent
-Status:           Open
+Status:           Wont fix
 Type:             Feature/Change Request
 Package:          HTTP_Request2
 Package Version:  2.0.0RC1
 PHP Version:      Irrelevant
 Roadmap Versions: 
 New Comment:

-Status: Open
+Status: Wont fix
There is nothing "exceptional" in HTTP status code other than 200 for
HTTP_Request2 package. This is just another valid HTTP response, which
HTTP_Request2 can properly handle, parse and return, unlike e.g.
connection errors and timeouts. If such a code is "exceptional" for your
application, then your application should react with an exception.


Previous Comments:
------------------------------------------------------------------------

[2011-08-19 14:46:51] doconnor

I'm mixed about this: though HTTP 200 OK is a very common status code;
with most 
others meaning bad things; the HTTP spec defines quite a lot of
behaviours.

Is HTTP 303 See Other a success or failure? Neither really. HTTP 404?
Well... 
missing isn't really broken. HTTP 418? Perhaps that's what you want in a
server 
sometimes.

Rico; couldn't you just extend one of the HTTP Request2 Adapters to add
in this 
behaviour? IE an acceptable result code adapter?

------------------------------------------------------------------------

[2011-08-19 11:12:21] ricson

Description:
------------
It'd be nice if I could configure HTTP_Request2 to automatically throw
an exception when a non-200 status code is returned.

This should of course be an optional config option.

------------------------------------------------------------------------


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18745&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.