ProxymanApp / ProxymanApp/Proxyman
[BUG] Scripting Tool cannot handle URL querystring parameters containing square brackets
@NghiaTranUIT is already working on this.
Since Mar 7, 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)
2.19.0 (21900)
macOS Version? (Ex. mac 10.14)
10.14.3
Steps to reproduce
- Enable SSL proxying for domain
deliver.kenticocloud.com:Toolsmenu >SSL Proxying List.- Check the
Enabled SSL Proxying Toolcheckbox. - Add the domain
deliver.kenticocloud.comto theInclude List.
- Create a script for
deliver.kenticocloud.com:Scriptingmenu >Script List- Create a new rule, and configure it with:
URL=*deliver.kenticocloud.com*- Method =
GET - Pattern matching =
Use Wildcard - Leave the
Include all subpaths of this URLcheckbox unchecked Run Script on=Responseonly- Script:
function onResponse(context, url, request, response) { console.log('response.statusCode = ' + response.statusCode); return response; }
- Click the
Save & Activatebutton.
- Click the
Consolebutton to open the Scripting Console. - In your browser (eg: Chrome), load this URL:
https://deliver.kenticocloud.com/5ac93d1e-567d-01e6-e3b7-ac435f77b907/items?system.id[eq]=a5f68d0f-6c6c-4845-b4d4-6bda702f0c1c - In the Scripting Console, the following error is displayed:
---------------------------------- 01:23:48.444: [onResponse] with Request ID=15 ❌Error: Couldn not build JSObject with URL=https://deliver.kenticocloud.com/5ac93d1e-567d-01e6-e3b7-ac435f77b907/items?system.id[eq]=a5f68d0f-6c6c-4845-b4d4-6bda702f0c1c
Expected behavior
The Scripting Console should display:
----------------------------------
01:23:48.444: [onResponse] with Request ID=15
response.statusCode = 200
01:23:48.446 onResponse() is executed!
Screenshot

Further details
If I remove [eq] from the URL:
- https://deliver.kenticocloud.com/5ac93d1e-567d-01e6-e3b7-ac435f77b907/items?system.id[eq]=a5f68d0f-6c6c-4845-b4d4-6bda702f0c1c
+ https://deliver.kenticocloud.com/5ac93d1e-567d-01e6-e3b7-ac435f77b907/items?system.id=a5f68d0f-6c6c-4845-b4d4-6bda702f0c1c
and then load this modified URL in Chrome, the Scripting Console displays the expected output:
----------------------------------
01:26:07.738: [onResponse] with Request ID=20
response.statusCode = 200
01:26:07.740 onResponse() is executed!
So it seems to be the [eq] querystring parameter in square brackets which is causing the Couldn not build JSObject with URL error ❌
There is some discussion online about whether square brackets should be percent-encoded ([] encoded as %5B%5D) to make a valid URL:
- [Stack Overflow] Is array syntax using square brackets in URL query strings valid?
- "For many years, every browser has left square brackets in query strings unencoded when submitting the request to the server. As such, I imagine a huge portion of the web has come to rely on this behavior, which makes it extremely unlikely to change."
As an example, the Kentico Kontent Delivery API expects unencoded square brackets:
- https://docs.kontent.ai/reference/delivery-api#tag/Filtering-content
system.type[eq]=articleelements.price[lt]=10elements.price[range]=10.5,50
So I think Proxyman's Scripting Tool needs to be able to support unencoded square brackets in querystring parameters, without crashing with the Couldn not build JSObject with URL error.
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.