[Asterisk-code-review] res ari: Correct Location headers returned by some ARI resou... (asterisk[13])
Anonymous Coward
asteriskteam at digium.com
Sat May 14 19:26:27 CDT 2016
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: res_ari: Correct Location headers returned by some ARI resources
......................................................................
res_ari: Correct Location headers returned by some ARI resources
The Location headers returned by:
* /bridges/{bridgeId}/play
* /bridges/{bridgeId}/record
* /channels/{channelId}/play
* /channels/{channelId}/record
Did not have the '/ari' prefix, and in the case of the 'play' resources, were
using 'playback' instead of 'playbacks.'
Change-Id: I957c58a3a1471bf477dae7c67faa1b74fcd9241c
---
M res/ari/resource_bridges.c
M res/ari/resource_channels.c
M res/res_ari.c
3 files changed, 4 insertions(+), 3 deletions(-)
Approvals:
Anonymous Coward #1000019: Verified
Matt Jordan: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c
index a37b831..a86f312 100644
--- a/res/ari/resource_bridges.c
+++ b/res/ari/resource_bridges.c
@@ -381,7 +381,7 @@
return -1;
}
- if (ast_asprintf(playback_url, "/playback/%s",
+ if (ast_asprintf(playback_url, "/playbacks/%s",
stasis_app_playback_get_id(playback)) == -1) {
playback_url = NULL;
ast_ari_response_alloc_failed(response);
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index f722802..9e2db9d 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -524,7 +524,7 @@
return;
}
- if (ast_asprintf(&playback_url, "/playback/%s",
+ if (ast_asprintf(&playback_url, "/playbacks/%s",
stasis_app_playback_get_id(playback)) == -1) {
playback_url = NULL;
ast_ari_response_error(
diff --git a/res/res_ari.c b/res/res_ari.c
index f39db16..4a0a22d 100644
--- a/res/res_ari.c
+++ b/res/res_ari.c
@@ -304,10 +304,11 @@
void ast_ari_response_created(struct ast_ari_response *response,
const char *url, struct ast_json *message)
{
+ RAII_VAR(struct stasis_rest_handlers *, root, get_root_handler(), ao2_cleanup);
response->message = message;
response->response_code = 201;
response->response_text = "Created";
- ast_str_append(&response->headers, 0, "Location: %s\r\n", url);
+ ast_str_append(&response->headers, 0, "Location: /%s%s\r\n", root->path_segment, url);
}
static void add_allow_header(struct stasis_rest_handlers *handler,
--
To view, visit https://gerrit.asterisk.org/2834
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I957c58a3a1471bf477dae7c67faa1b74fcd9241c
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-code-review
mailing list