Repository navigation
Keep an API response's body verbatim - #17
Closed
henrikbjorn wants to merge 1 commit into
Closed
henrikbjorn wants to merge 1 commit into
henrikbjorn wants to merge 1 commit into
Conversation
An api/response body is the command's output, not headers. Parsing it as
key-value lines mangled any output containing a colon: `global_getvar
hold_music` returning "local_stream://latin" came back as
{local_stream: "//latin", body: ""}. The content of an api/response is
now the raw body string. Events and command replies are parsed as before.
This was referenced Sep 30, 2026
Member
Author
|
Folded into #25, which collects these changes in one PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An
api/responsebody is the command's output, not headers.Responseparsed it as key-value lines whenever it contained a colon, which mangled any such output. For example,global_getvar hold_musicreturninglocal_stream://latincame back as{local_stream: "//latin", body: ""}.The content of an
api/responseis now the raw body string. Events and command replies are parsed as before. Error handling is unchanged: an API error is still a-ERR …body, not a raised error.Behaviour change
The Content-Type decides, as the ESL protocol defines it:
text/event-plainandcommand/replycarry headers and are still parsed; anapi/responsecarries opaque command output. Guessing from the content ("does it look like key-value lines?") would still misparse output such asuuid_dump, or a variable whose value happens to beStatus: ok.What changes for callers:
uuid_exists→"true",create_uuid→ a uuid): unchanged. It was already a raw String.switch/freeswitch/scripts/switch_api.rb#callback_request_exists?readsshow channels like …output viacontent[:body]. relatel/switch#1258 makes it work with both formats, and it must ship before switch's scripts update librevox. A search of our repos found no other reads of parsed API output.Needed by relatel/baritone's
receptionist-prereqsbranch (Controller#api,#get_variable). Both it andswitch/receptionistpin this branch until it merges.Tests
bundle exec rake test: 122 runs, including the newtest_api_response_content_is_the_raw_body.