getRequestMethod already exists as getMethod()

This is about the convenience methods $this->isPost() is quite convenient. as would isGet and isHead....

I'm more concerned with the original enhancements I spoke of in terms of unifying the getParam and getHeader methods such that they follow the same api consistency as getQuery, getPost, getCookie, getServer, getEnv

Right now headers and params follow a different api.

Kevin

----- Original Message ----- From: "Matthew Weier O'Phinney" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 20, 2007 1:01 PM
Subject: Re: [fw-general] Cleanup Zend_Request


-- Kevin McArthur <[EMAIL PROTECTED]> wrote
(on Tuesday, 20 March 2007, 01:03 PM -0700):
I'm not saying we need full support for PUT, DELETE just yet, but to think
that HTTP methods are binary either post or not isn't quite correct. HEAD
requests are of particular importance for modern rss readers for example.
I'd just add an isGet and isHead method at this point and unify the api to
be a bit more consistent.

Typically, when I think MVC, I'm not thinking REST or RSS, but those are
valid uses for it as well.

I don't want to clutter the API with a ton of isXXX() methods. I think
it would make more sense to do something like getRequestMethod() that
determines the request method, does some normalization (to lower or
upper case, for instance), and returns that value. Then the developer
can do either simple logic or switch statements:

   if ('post' == $request->getRequestMethod()) {
       // handle post request...
   }

   // or
   switch ($request->getRequestMethod()) {
       case 'post':
           // handle post...
           break;
       case 'head':
           // handle head...
           break;
       // ...
       default:
           throw Exception('Invalid request method');
   }

I'll put this in the issue tracker as an enhancement; likely it will not
go in until post 1.0.

----- Original Message ----- From: "Codiac" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 20, 2007 2:31 AM
Subject: Re: [fw-general] Cleanup Zend_Request


>
>Kevin,
>
>I know PHP can handle PUT, DELETE and other requests as well. They're >just
>not handled the same way as POST and GET. Requests + the body of the
>request
>are always put into the PHP:// stream (like php://input).
>
>The question is will Zend Framework support these type of requests? If >you
>look into the REST server implementation, those request types aren't
>supported. Therefore the Zend Server_Rest implementation isn't a
>full-fledged REST implementation.
>-- >View this message in context:
>http://www.nabble.com/Cleanup-Zend_Request-tf3424362s16154.html#a9568055
>Sent from the Zend Framework mailing list archive at Nabble.com.
>


--
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/

Reply via email to