[GH-ISSUE #1459] script the request.isURLEncoding not work #1452

Open
opened 2026-03-03 19:51:39 +03:00 by kerem · 3 comments
Owner

Originally created by @maotong06 on GitHub (Dec 7, 2022).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1459

Description

Steps to Reproduce

1.set isURLEncoding = false
2.proxy a html request ex: i want : http://a.com/abc.html?q=h ---> http://localhost/abc.html?q=h
3. but send request: http://localhost/abc.html%3Fq=h
4.

Current Behavior

isURLEncoding is not work

Expected Behavior

set request http://localhost/abc.html?q=h

Environment

  • App version: e.g Proxyman 3.9.0
  • macOS version: e.g macOS Monterey
Originally created by @maotong06 on GitHub (Dec 7, 2022). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1459 ## Description <!--- Description for the bug? --> ## Steps to Reproduce <!-- Add relevant code and/or a live example --> 1.set isURLEncoding = false 2.proxy a html request ex: i want : http://a.com/abc.html?q=h ---> http://localhost/abc.html?q=h 3. but send request: http://localhost/abc.html%3Fq=h 4. ## Current Behavior <!--- What went wrong? --> isURLEncoding is not work ## Expected Behavior <!--- What should have happened? --> set request http://localhost/abc.html?q=h ## Environment - App version: e.g Proxyman 3.9.0 - macOS version: e.g macOS Monterey
Author
Owner

@maotong06 commented on GitHub (Dec 7, 2022):

i set my script is

  if (reg.test(url)) {
    const urlPath = reg.exec(url)[3]
    if (urlPath) {
      request.scheme = 'http';
      request.host = 'localhost';
      request.port = 9090;
      request.path = '/' + urlPath
      request.isURLEncoding = false
    } else {
      return request;
    }
  }
  return request;

I don't want to pull out this query and set it myself

<!-- gh-comment-id:1341058289 --> @maotong06 commented on GitHub (Dec 7, 2022): i set my script is ``` if (reg.test(url)) { const urlPath = reg.exec(url)[3] if (urlPath) { request.scheme = 'http'; request.host = 'localhost'; request.port = 9090; request.path = '/' + urlPath request.isURLEncoding = false } else { return request; } } return request; ``` I don't want to pull out this query and set it myself
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 9, 2022):

Hey, if you'd like to change the Host, you don't need to modify the Path.

Just simply use:

if (reg.test(url)) {
    const urlPath = reg.exec(url)[3]
    if (urlPath) {
      request.scheme = 'http';
      request.host = 'localhost';
      request.port = 9090;
    } else {
      return request;
    }
  }
  return request;

=> The path is intact.

<!-- gh-comment-id:1343918070 --> @NghiaTranUIT commented on GitHub (Dec 9, 2022): Hey, if you'd like to change the Host, you don't need to modify the Path. Just simply use: ```js if (reg.test(url)) { const urlPath = reg.exec(url)[3] if (urlPath) { request.scheme = 'http'; request.host = 'localhost'; request.port = 9090; } else { return request; } } return request; ``` => The path is intact.
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 9, 2022):

Regarding your code: I believe that const urlPath = reg.exec(url)[3], urlPath contains the Query part too.

You can use console.log(urlPath) to see the output.

Thus, assigning it to the request.path, causes the bug.

The isURLEncoding only applies to the Query Part, not the URL.

<!-- gh-comment-id:1343921157 --> @NghiaTranUIT commented on GitHub (Dec 9, 2022): Regarding your code: I believe that `const urlPath = reg.exec(url)[3]`, `urlPath` contains the Query part too. You can use console.log(urlPath) to see the output. Thus, assigning it to the `request.path`, causes the bug. The `isURLEncoding` only applies to the Query Part, not the URL.
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#1452
No description provided.