summaryrefslogtreecommitdiff
path: root/res/ari
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2013-11-12 22:17:28 +0000
committerKevin Harwell <kharwell@digium.com>2013-11-12 22:17:28 +0000
commit4be01b4598f37431809980907d1ab7ce02d0e47a (patch)
tree290c7d55c8a83597ddb6a968768510125458212d /res/ari
parent94f19c82184bf508adc3f5e2398d0a776491b53c (diff)
ari endpoints: GET /ari/endpoints/{invalid-tech} should return a 404
Implementation listing endpoints by technology returned an empty array if no matching endpoints were found. Fixed so a "404 Not Found" will be returned instead. (closes issue ASTERISK-22803) Reported by: David M. Lee ........ Merged revisions 402787 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402788 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ari')
-rw-r--r--res/ari/resource_endpoints.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/res/ari/resource_endpoints.c b/res/ari/resource_endpoints.c
index 181ce7a50..e08f6e559 100644
--- a/res/ari/resource_endpoints.c
+++ b/res/ari/resource_endpoints.c
@@ -89,8 +89,6 @@ void ast_ari_endpoints_list_by_tech(struct ast_variable *headers,
struct ao2_iterator i;
void *obj;
- /* TODO - if tech isn't a recognized type of endpoint, it should 404 */
-
cache = ast_endpoint_cache();
if (!cache) {
ast_ari_response_error(
@@ -131,7 +129,12 @@ void ast_ari_endpoints_list_by_tech(struct ast_variable *headers,
}
ao2_iterator_destroy(&i);
- ast_ari_response_ok(response, ast_json_ref(json));
+ if (ast_json_array_size(json)) {
+ ast_ari_response_ok(response, ast_json_ref(json));
+ } else {
+ ast_ari_response_error(response, 404, "Not Found",
+ "No Endpoints found with tech %s", args->tech);
+ }
}
void ast_ari_endpoints_get(struct ast_variable *headers,
struct ast_ari_endpoints_get_args *args,