ProxymanApp / ProxymanApp/Proxyman
Scripts that assign the JSON response.body to true fail
Open
@NghiaTranUIT is already working on this.
Since Oct 12, 2021.
✅ Done
bug
- Dominant language
- No language data
- Stars
- 7k
- Forks
- 237
- PR merge metrics
- No merged PRs in 30d
Description
Scripts that assign the response.body to true fail with an error (see below for error details).
If I wrap the true literal in a JSON object, it works. However, true is valid JSON, and many JSON APIs return only boolean literals.
Here's the full script I'm using:
function onResponse(context, url, request, response) {
response.body = true;
response.headers["Content-Type"] = "application/json"
response.statusCode = 200
return response;
}
Proxyman version
2.33.0 (23300)
macOS Version
11.6 (20G165)
Steps to reproduce
- Create a script
- Enter the script content above
- Save and activate it
- Exercise the script by requesting the endpoint
Expected behavior
The response body is true
Actual behavior
An error is reported:
❌Error: Invalid Body JSON Object. Please verify the body is a valid JSON. (Content-Type=application/json)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.