From: Robert 'phaylon' Sedlacek Date: Fri, 7 Aug 2009 21:49:29 +0000 (+0200) Subject: changed type validation error to 404 X-Git-Tag: 0.005~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=67f399400dae8248bf3d67c9c07f3c8310512fc2;hp=f0671dfc0155e7440226712a6b27e7890a10e533;p=catagits%2FCatalystX-Declare.git changed type validation error to 404 --- diff --git a/examples/MyApp-Web/t/02functionality.t b/examples/MyApp-Web/t/02functionality.t index fac9806..0ccdf0e 100644 --- a/examples/MyApp-Web/t/02functionality.t +++ b/examples/MyApp-Web/t/02functionality.t @@ -15,13 +15,13 @@ is get('/calc/add/3/4/5'), 12, 'addition'; is get('/calc/multiply/2/3/4'), 24, 'multiplication'; is get('/calc/unknownthingy/3/4/5'), 'unknown operator', 'unknown operator'; -is get('/calc/add/3/f/5'), 'Bad Request', 'bad request'; +is get('/calc/add/3/f/5'), 'Not found', 'bad request'; like get('/foo/hello'), qr/root controller role/, 'root controller role'; is get('/foo/2/3/add'), 5, 'add two'; is get('/foo/2/3/multiply'), 6, 'multiply two'; -is get('/foo/2/f/add'), 'Bad Request', 'bad request capture args'; +is get('/foo/2/f/add'), 'Not found', 'bad request capture args'; done_testing; diff --git a/lib/CatalystX/Declare/Action/CatchValidationError.pm b/lib/CatalystX/Declare/Action/CatchValidationError.pm index f7e1f62..585b793 100644 --- a/lib/CatalystX/Declare/Action/CatchValidationError.pm +++ b/lib/CatalystX/Declare/Action/CatchValidationError.pm @@ -20,8 +20,8 @@ role CatalystX::Declare::Action::CatchValidationError { $ctx->error("BAD REQUEST: $error"); } else { - $ctx->response->body( 'Bad Request' ); - $ctx->response->status( 400 ); + $ctx->response->body( 'Not found' ); + $ctx->response->status( 404 ); } $ctx->detach; diff --git a/t/051_modifier_signatures.t b/t/051_modifier_signatures.t index 531a502..6138f42 100644 --- a/t/051_modifier_signatures.t +++ b/t/051_modifier_signatures.t @@ -11,7 +11,7 @@ use Catalyst::Test 'TestApp'; is get('/modsig/foo/2/3'), 'modifiersignatures/foo modified', 'intended arguments work'; is get('/modsig/foo/2'), 'Page Not Found', 'missing argument leads to 404'; is get('/modsig/foo/2/3/4'), 'Page Not Found', 'one argument too many leads to 404'; -is get('/modsig/foo/a/b'), 'Bad Request', 'invalid arguments lead to bad request'; +is get('/modsig/foo/a/b'), 'Not found', 'invalid arguments lead to bad request'; done_testing; diff --git a/t/060_exception_handling.t b/t/060_exception_handling.t index d910ea9..e0450bb 100644 --- a/t/060_exception_handling.t +++ b/t/060_exception_handling.t @@ -18,9 +18,9 @@ my $modget = sub { get(join '/', '/sub_errors/signature_error_on_foo_modify', @_ local *TestApp::debug = sub { 0 }; -is $get->('foo'), 'Bad Request', 'detected action signature error'; -is $subget->('foo'), 'Bad Request', 'detected action signature error (child)'; -is $modget->('foo'), 'Bad Request', 'detected action signature error (modified)'; +is $get->('foo'), 'Not found', 'detected action signature error'; +is $subget->('foo'), 'Not found', 'detected action signature error (child)'; +is $modget->('foo'), 'Not found', 'detected action signature error (modified)'; stderr_like { diff --git a/t/100_complex.t b/t/100_complex.t index 91fb45f..93df766 100644 --- a/t/100_complex.t +++ b/t/100_complex.t @@ -62,7 +62,7 @@ is get('/foo/surrounded_target'), 'foo/surrounded_target surrounded', 'action wa is get('/foo/inline_class'), 'HELLO', 'inline classes work as expected'; # error handling -is get('/foo/wants_integer/butdoesntgetone'), 'Bad Request', 'validation error causes bad request error'; +is get('/foo/wants_integer/butdoesntgetone'), 'Not found', 'validation error causes bad request error'; # fix bug with capture args below under { } is get('/foo/lower/down/the/param/3/road/5'), 8, 'capture args and block under work together';