nova
nova copied to clipboard
WIP: Return 405 error when a route is defined but method is not.
This PR also includes a fix to when a 500 error occurs.
Tested this and it still rerturns 404.
route: {"/json_post", { nova_request_app_main_controller, json_post}, #{methods => [post]}},
Response: {{badmatch,#{body => <<"{"message":[82,101,115,111,117,114,99,101,32,110,111,116,32,102,111,117,110,100]}">>, headers => #{'Connection' => <<"close">>,'Content-Length' => <<"81">>, 'Content-Type' => <<"application/json">>, 'Date' => <<"Thu, 29 Sep 2022 08:03:00 GMT">>, 'Server' => <<"Cowboy/Nova">>, 'Set-Cookie' => <<"session_id=NaJAeaaljPGnciMVkZbw9Teav6B4G6EK38/NdOo2tq8=; Version=1">>}, status => {404,<<"Not Found">>}}}, [{nova_request_app_SUITE,post_json_with_get_405,1, [{file,"/home/daniel/project/nova_request_app/test/nova_request_app_SUITE.erl"}, {line,156}]}, {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]}, {test_server,run_test_case_eval1,6,[{file,"test_server.erl"},{line,1292}]}, {test_server,run_test_case_eval,9,[{file,"test_server.erl"},{line,1224}]}]}
Tested this and it still rerturns 404.
route: {"/json_post", { nova_request_app_main_controller, json_post}, #{methods => [post]}},
Response: {{badmatch,#{body => <<"{"message":[82,101,115,111,117,114,99,101,32,110,111,116,32,102,111,117,110,100]}">>, headers => #{'Connection' => <<"close">>,'Content-Length' => <<"81">>, 'Content-Type' => <<"application/json">>, 'Date' => <<"Thu, 29 Sep 2022 08:03:00 GMT">>, 'Server' => <<"Cowboy/Nova">>, 'Set-Cookie' => <<"session_id=NaJAeaaljPGnciMVkZbw9Teav6B4G6EK38/NdOo2tq8=; Version=1">>}, status => {404,<<"Not Found">>}}}, [{nova_request_app_SUITE,post_json_with_get_405,1, [{file,"/home/daniel/project/nova_request_app/test/nova_request_app_SUITE.erl"}, {line,156}]}, {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]}, {test_server,run_test_case_eval1,6,[{file,"test_server.erl"},{line,1292}]}, {test_server,run_test_case_eval,9,[{file,"test_server.erl"},{line,1224}]}]}
Guess that it's working with the other branch for routing_tree?