Proxyman icon indicating copy to clipboard operation
Proxyman copied to clipboard

jwt string in request body gets converted to json payload when scripting is enabled

Open theelbowclaps opened this issue 1 year ago • 3 comments

Description

I'm working with an API that uses custom "Content-Type" header and the request body is a jwt string. Whenever I enable Scripting, the jwt in the body gets converted to a json payload. My script does not even contain any logic that modifies the request.

async function onRequest(context, url, request) {
  return request;
}

Steps to Reproduce

  1. Enable Scripting
  2. run:
curl -X POST https://www.example.com -H "Content-Type: application/my-custom-type" --data-raw "eyJzdGF0dXMiOiJydW5uaW5nIiwiYWN0aW9ucyI6W3sidHlwZSI6InNldCIsIm91dHB1dCI6Imxpbmtfc291cmNlIiwidmFsdWUiOiJkZWZhdWx0IiwiZG9uZSI6dHJ1ZX1dfQ==" --proxy http://localhost:9090

Current Behavior

Payload is altered: image

Expected Behavior

request body should remain as eyJzdGF0dXMiOiJydW5uaW5nIiwiYWN0aW9ucyI6W3sidHlwZSI6InNldCIsIm91dHB1dCI6Imxpbmtfc291cmNlIiwidmFsdWUiOiJkZWZhdWx0IiwiZG9uZSI6dHJ1ZX1dfQ==

Environment

  • App version: e.g Proxyman 4.15.0
  • macOS version: macOS Monterey

theelbowclaps avatar Dec 23 '23 03:12 theelbowclaps

Thanks. I will investigate this bug and get back to you asap 👍

NghiaTranUIT avatar Dec 23 '23 07:12 NghiaTranUIT

@theelbowclaps you can try this Beta build: https://download.proxyman.io/beta/Proxyman_4.15.0_Fix_Scripting_with_Body_String.dmg

  • Fix the Script issue when it tried to parse the string to base64 data (due to unknown Content-Type)

NghiaTranUIT avatar Dec 24 '23 02:12 NghiaTranUIT

@theelbowclaps you can try this Beta build: https://download.proxyman.io/beta/Proxyman_4.15.0_Fix_Scripting_with_Body_String.dmg

  • Fix the Script issue when it tried to parse the string to base64 data (due to unknown Content-Type)

It's working great now. Thanks a bunch!

theelbowclaps avatar Dec 27 '23 05:12 theelbowclaps