Hi all,
I'm trying to get my REST services up and running, the routing works, but
when i do a POST to my service, the RequestHandler->isPost() function
returns false.
Could somebody help me out what I'm doing wrong???
*Routes.php*
Router::connect(
'/authenticate',
array(
'controller' => 'users',
'action' => 'login',
'[method]' => 'POST')
);
> Router::parseExtensions('json');
* Login function in UsersController.php (for demo purpose i just return if
> it detects a post or not)*
if( $this->RequestHandler->isPost() ) {
> $this->set('loginResult', 'post');
> $this->set('_serialize', array('loginResult'));
> }else{
> $this->set('loginResult', 'no post');
> $this->set('_serialize', array('loginResult'));
> }
Now I use* REST Console* extension in Chrome to do a call to my REST
service (http://path_to_localhost_website/authenticate)
This is the result returned:
*Request Headers*
1. Accept: application/json
2. Content-Type: application/json
3. Connection: keep-alive
4. Origin: chrome-extension: //rest-console-id
5. User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit
/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11
*Request Body*
1. Request Url: http://localhost/ris/winsol/winsol_admin/authenticate
2. Request Method: POST
3. Status Code: 200
4. Params: {
5. "email": "[email protected]",
6. "password": "fd12d90f5670211f5bd4f2816baa7299eb256e1f"
7. }
*Response Headers*
1. Status Code: 200
2. Date: Thu, 26 Jul 2012 20:25:41 GMT
3. X-Powered-By: PHP/5.3.6
4. Connection: Keep-Alive
5. Content-Length: 25
6. Server: Apache
7. Content-Type: application/json
8. Keep-Alive: timeout=5, max=99
*Response Body:*
{ "loginResult": "no post" }
I hope somebody can help me out, because it is driving me mad :-)
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php