Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: heavily simplify multipart formdata snippet generation #224

Merged
merged 3 commits into from
Apr 8, 2024

Conversation

erunion
Copy link
Member

@erunion erunion commented Apr 8, 2024

🧰 Changes

In September of last year I reworked this library1 off node-fetch and the funky non-native FormData object it ships to only support native FormData -- in the process making code snippet generation asynchronous. Unfortunately this async work is causing us some headaches on integrating it into our API Explorer.

I started to dig in to trying to make formdata-to-string synchronous and realized... why bother? We have the HAR, we can generate everything we need for a multipart boundary from that.

  • Completely removes the FormData and Blob API dependencies from this library.
  • Made .convert() a synchronous operation again.

Footnotes

  1. https://github.com/readmeio/httpsnippet/pull/199

@erunion erunion added enhancement New feature or request refactor Issues about tackling technical debt labels Apr 8, 2024
@erunion erunion requested a review from kanadgupta April 8, 2024 20:07
Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wowow so much better 🥹

src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
@erunion erunion merged commit 966ab0e into main Apr 8, 2024
11 checks passed
@erunion erunion deleted the feat/remove-formdata-dependency branch April 8, 2024 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor Issues about tackling technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants