You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure when there's a valid case to return the $responseBody quoted, but at least in this case it causes problems where the content-type is text/xml.
When this gets added to the JSON object (line 177), the result is "?", and the custom function returns the following error: "SyntaxError: eof or line terminator while parsing string literal (line 3)."
I added another test at line 161 for a content-type of text/xml, with the following code:
The quoting thing is an escape hatch. There are strange edge cases where you might need it. Generator is optimized for use with JSON. XML and form-data SHOULD get built out, but almost no work has been done with them.
See script: HTTP BaseElements( {request} ).
The default handling of the response body for "other" content-types (see line 162) is:
I'm not sure when there's a valid case to return the $responseBody quoted, but at least in this case it causes problems where the content-type is text/xml.
Sample $responseBody returned from API:
<?xml version="1.0" encoding="UTF-8"?><rsp stat="ok" version="1.0"> <api_key>asdfasdfasfda</api_key></rsp>
Note: there are multiple Char(10) characters that are not visible in the text (above).
Here's what it gets converted to:
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><rsp stat=\"ok\" version=\"1.0\"> <api_key>kasjf;lskdfj;asldjk</api_key></rsp>"
When this gets added to the JSON object (line 177), the result is "?", and the custom function returns the following error: "SyntaxError: eof or line terminator while parsing string literal (line 3)."
I added another test at line 161 for a content-type of text/xml, with the following code:
Note: this is almost the same as the code above, except it doesn't quote the result and also converts line feeds (i.e., Char ( 10 )).
The text was updated successfully, but these errors were encountered: