mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-25 16:15:55 +03:00
[GH-ISSUE #1906] Multipart $http.post() in scripts #1898
Labels
No labels
Discussion
Feature request
In Progress...
Plugins
Waiting response
Windows
Windows
bug
duplicate
enhancement
feature
good first issue
iOS
macOS 10.11
question
wontfix
✅ Done
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Proxyman#1898
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nihaals on GitHub (Jan 13, 2024).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1906
Originally assigned to: @NghiaTranUIT on GitHub.
Description
It would be great if there was a way to do a
multipart/form-datarequest in scripts.Why this feature/change is important?
If you need to call an API that requires
multipartyou need to addFormDatapolyfills which also might not interact with$http.post()correctly as the function itself isn't documented.@NghiaTranUIT commented on GitHub (Jan 14, 2024):
You're right @nihaals , the Scriprint tool doesn't support the FormData or
multipart. The problem is JavascriptCore framework (from Apple) doesn't support axios, fetch, or URLSearchParam, or FormData.I'm thinking if I can replace our custom
$httpwithwhatwg-fetch(https://www.npmjs.com/package/whatwg-fetch) to the Scripting, so it can work with FormData and other type of body.@nihaals commented on GitHub (Jan 14, 2024):
Being able to point to exactly what Proxyman uses sounds quite helpful as it would reduce the need for as thorough documentation on
$httpand especially if it's based onfetch(), its usage will be fairly intuitive and similar to JS people have already written. I also think trying to make Proxyman match a typical JS environment as much as possible makes it feel less like "it's JS syntax but a custom environment" and more like "it's just JS" (which documenting the environment scripts run in would also help with so users can dive into more docs if needed and search for workarounds).@NghiaTranUIT commented on GitHub (Jan 15, 2024):
@nihaals It's so difficult to support native
fetchbecauseXMLHTTPRequestdoesn't support in JavascriptCore too.Even with React-native-fetch, they also develop their own custom
XMLHTTPRequestwith a lot of react-native logic. Tried to bring to Proxyman, but no luck 😢The same thing with axios, or superagent too, it's built on top of
XMLHTTPRequest@nihaals commented on GitHub (Jan 17, 2024):
I guess you'd basically need to do something like https://github.com/Lukas-Stuehrk/XMLHTTPRequest? I have no idea how much work that is but I guess one advantage would be that if it passes tests you wouldn't have to mess with
$httpmuch again?@NghiaTranUIT commented on GitHub (Jan 17, 2024):
I tried, but it didn't work. The
fetch-polyfillrecognizes the XMLHttpRequest, but it stuck when making a request.I guess this library is obsoleted (the last update was 7 years ago), and it only handles the Text-based Response body (https://github.com/Lukas-Stuehrk/XMLHTTPRequest/issues/1)
@nihaals commented on GitHub (Jan 17, 2024):
Maybe a simpler solution would be adding
FormDataand supporting$http.post({body: FormData})?