summaryrefslogtreecommitdiff
path: root/src/mod_http_api.erl
diff options
context:
space:
mode:
authorMickael Remond <mremond@process-one.net>2016-08-01 15:29:47 +0200
committerMickael Remond <mremond@process-one.net>2016-08-01 15:29:47 +0200
commit90ea3ca3613d7e342ba64e45cefcbe1227ee88c7 (patch)
treea5fe38a322fc1db659f996a23b5ad7ee0f1fa160 /src/mod_http_api.erl
parentFix error return expectation in command test (diff)
Improve error message when try to call api on api root
Diffstat (limited to 'src/mod_http_api.erl')
-rw-r--r--src/mod_http_api.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mod_http_api.erl b/src/mod_http_api.erl
index a91c3c1a..73e6f7e4 100644
--- a/src/mod_http_api.erl
+++ b/src/mod_http_api.erl
@@ -253,7 +253,7 @@ process([Call], #request{method = 'GET', q = Data, ip = IP} = Req) ->
catch
%% TODO We need to refactor to remove redundant error return formatting
throw:{error, unknown_command} ->
- json_format({404, 40, <<"Command not found.">>});
+ json_format({404, 44, <<"Command not found.">>});
_:_Error ->
?DEBUG("Bad Request: ~p ~p", [_Error, erlang:get_stacktrace()]),
@@ -263,7 +263,7 @@ process([], #request{method = 'OPTIONS', data = <<>>}) ->
{200, ?OPTIONS_HEADER, []};
process(_Path, Request) ->
?DEBUG("Bad Request: no handler ~p", [Request]),
- badrequest_response().
+ json_error(400, 40, <<"Missing command name.">>).
%% Be tolerant to make API more easily usable from command-line pipe.
extract_args(<<"\n">>) -> [];