ProxymanApp / ProxymanApp/Proxyman
Script Error: Could not parse the body as Plain-Text. (Content-Type=text/html; charset=utf-8)
@NghiaTranUIT is already working on this.
Since Aug 5, 2021.
- Dominant language
- No language data
- Stars
- 7k
- Forks
- 237
- PR merge metrics
- No merged PRs in 30d
Description
Proxyman version? (Ex. Proxyman 1.4.3)
Version 2.30.0
macOS Version? (Ex. mac 10.14)
11.4
Steps to reproduce
function onResponse(context, url, request, response) {
var bodyStr = response.body;
var decodeBody = atob(bodyStr);
var jsonBody = JSON.parse(decodeBody);
var counter = jsonBody["count"];
counter = counter + 1;
console.log(counter);
var jsonBody["count"] = counter;
var jsonStr= JSON.stringify(jsonBody);
var jsonEncode = btoa(jsonStr);
console.log(jsonEncode);
response.body = jsonEncode;
return response;
}
Expected behavior
In the last step, it should base64 encode the json string and send it to the client, but the log shows null for json.Encode and throws the following error:
❌Error: Could not parse the body as Plain-Text. (Content-Type=text/html; charset=utf-8)
Screenshots (optional)
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.