diff options
author | zuul <zuul@gerrit.asterisk.org> | 2016-08-19 16:57:06 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-08-19 16:57:06 -0500 |
commit | fcc49d760f68cc4e42e56397e3bcf0049ea288ac (patch) | |
tree | 0c51d757a3bbd3fcbd0579cb3ba2f3d221f1ccb0 /res | |
parent | 6b3e96e47951721111379965f6ffc358ead05b93 (diff) | |
parent | 6f448f32fe9b7379e2630fab7b06205f901f2ded (diff) |
Merge "res_ari: Add http prefix to generated docs" into 13
Diffstat (limited to 'res')
-rw-r--r-- | res/res_ari.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/res/res_ari.c b/res/res_ari.c index 4a0a22d79..4ff98ce96 100644 --- a/res/res_ari.c +++ b/res/res_ari.c @@ -579,7 +579,7 @@ void ast_ari_invoke(struct ast_tcptls_session_instance *ser, } } -void ast_ari_get_docs(const char *uri, struct ast_variable *headers, +void ast_ari_get_docs(const char *uri, const char *prefix, struct ast_variable *headers, struct ast_ari_response *response) { RAII_VAR(struct ast_str *, absolute_path_builder, NULL, ast_free); @@ -685,9 +685,15 @@ void ast_ari_get_docs(const char *uri, struct ast_variable *headers, } } if (host != NULL) { - ast_json_object_set( - obj, "basePath", - ast_json_stringf("http://%s/ari", host->value)); + if (prefix != NULL && strlen(prefix) > 0) { + ast_json_object_set( + obj, "basePath", + ast_json_stringf("http://%s%s/ari", host->value,prefix)); + } else { + ast_json_object_set( + obj, "basePath", + ast_json_stringf("http://%s/ari", host->value)); + } } else { /* Without the host, we don't have the basePath */ ast_json_object_del(obj, "basePath"); @@ -969,7 +975,7 @@ static int ast_ari_callback(struct ast_tcptls_session_instance *ser, ast_ari_response_error(&response, 405, "Method Not Allowed", "Unsupported method"); } else { /* Skip the api-docs prefix */ - ast_ari_get_docs(strchr(uri, '/') + 1, headers, &response); + ast_ari_get_docs(strchr(uri, '/') + 1, urih->prefix, headers, &response); } } else { /* Other RESTful resources */ |