[Jifty-commit] r5138 - in jifty/trunk: . lib/Jifty/Plugin/OAuth

Jifty commits jifty-commit at lists.jifty.org
Tue Feb 19 19:20:58 EST 2008


Author: sartak
Date: Tue Feb 19 19:20:57 2008
New Revision: 5138

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm
   jifty/trunk/t/TestApp-Plugin-OAuth/t/02-request-token.t

Log:
 r51947 at onn:  sartak | 2008-02-19 19:07:12 -0500
 Give response code 405 (invalid method) on GET /oauth/{request,access}_token


Modified: jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm	Tue Feb 19 19:20:57 2008
@@ -16,6 +16,9 @@
 on     POST '/oauth/access_token'  => \&access_token;
 on          '/oauth/authorized'    => run { redirect '/oauth/authorize' };
 
+on     GET  '/oauth/request_token' => \&invalid_method;
+on     GET  '/oauth/access_token'  => \&invalid_method;
+
 before '*' => \&try_oauth;
 
 =head2 abortmsg CODE, MSG
@@ -262,6 +265,17 @@
     Jifty->web->temporary_current_user(Jifty->app_class('CurrentUser')->new(id => $access_token->auth_as));
 }
 
+=head2 invalid_method
+
+This aborts the request with an "invalid HTTP method" response code.
+
+=cut
+
+sub invalid_method {
+    Jifty->web->response->add_header(Allow => 'POST');
+    abort(405);
+}
+
 =head2 get_consumer CONSUMER KEY
 
 Helper function to load a consumer by consumer key. Will abort if the key

Modified: jifty/trunk/t/TestApp-Plugin-OAuth/t/02-request-token.t
==============================================================================
--- jifty/trunk/t/TestApp-Plugin-OAuth/t/02-request-token.t	(original)
+++ jifty/trunk/t/TestApp-Plugin-OAuth/t/02-request-token.t	Tue Feb 19 19:20:57 2008
@@ -260,8 +260,8 @@
 # }}}
 # GET not POST {{{
 response_is(
-    code                   => 404,
-    testname               => "404 - GET not supported for request_token",
+    code                   => 405,
+    testname               => "405 - GET not allowed for request_token",
     consumer_secret        => 'bar',
     oauth_consumer_key     => 'foo',
     oauth_signature_method => 'PLAINTEXT',


More information about the Jifty-commit mailing list