ProxymanApp / ProxymanApp/Proxyman

Script Error: Could not parse the body as Plain-Text. (Content-Type=text/html; charset=utf-8)

Open
#955 15 comments 0 reactions 1 assignee View on GitHub

@NghiaTranUIT is already working on this.

Since Aug 5, 2021.

bug
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.