[GH-ISSUE #1894] jwt string in request body gets converted to json payload when scripting is enabled #1887

Open
opened 2026-03-03 19:55:11 +03:00 by kerem · 3 comments
Owner

Originally created by @pbt4991 on GitHub (Dec 23, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1894

Originally assigned to: @NghiaTranUIT on GitHub.

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
Originally created by @pbt4991 on GitHub (Dec 23, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1894 Originally assigned to: @NghiaTranUIT on GitHub. ## 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 <!-- Add relevant code and/or a live example --> 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: <img width="752" alt="image" src="https://github.com/ProxymanApp/Proxyman/assets/49348488/0b765f48-0bb1-4584-abb8-71dc63b441cf"> ## Expected Behavior request body should remain as `eyJzdGF0dXMiOiJydW5uaW5nIiwiYWN0aW9ucyI6W3sidHlwZSI6InNldCIsIm91dHB1dCI6Imxpbmtfc291cmNlIiwidmFsdWUiOiJkZWZhdWx0IiwiZG9uZSI6dHJ1ZX1dfQ==` ## Environment - App version: e.g Proxyman 4.15.0 - macOS version: macOS Monterey
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 23, 2023):

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

<!-- gh-comment-id:1868227301 --> @NghiaTranUIT commented on GitHub (Dec 23, 2023): Thanks. I will investigate this bug and get back to you asap 👍
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 24, 2023):

@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)
<!-- gh-comment-id:1868419944 --> @NghiaTranUIT commented on GitHub (Dec 24, 2023): @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)
Author
Owner

@pbt4991 commented on GitHub (Dec 27, 2023):

@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!

<!-- gh-comment-id:1869967939 --> @pbt4991 commented on GitHub (Dec 27, 2023): > @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!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1887
No description provided.