postmanlabs / postmanlabs/postman-code-generators

Boundaries for multipart requests in plain HTTP are incorrect

Open
#616 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

codegen good first issue
Dominant language
JavaScript
Stars
1k
Forks
381
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
Currently, the Code Generator for (plain) HTTP is using the same boundary everywhere instead of following the RFC. When trying to send the generated code through an HTTP client, e.g. in IntelliJ, the IDE will point out that the boundaries are incorrect, and the request will fail.

To Reproduce
Steps to reproduce the behavior:

  • create a POST using a form-data body
  • add a key "foo" and text value "bar"
  • generate the HTTP code

Expected code snippet and corresponding request
The generated code is correct according to the definition of the aforementioned RFC which means:

  • there is a boundary defined alongside Content-Type: multipart/form-data (let's say xyz)
  • the boundary is used to separate different form data with two additional hyphens before (--xyz)
  • the request ends with a boundary with two leading and trailing hyphens (--xyz--)

Screenshots
All boundaries are identical but should follow the rules above.
A screenshot of the generated code

Additional context
Version of postman-code-generators/Postman app: 9.16.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the plain HTTP code generation for a POST with a form-data body containing the foo/bar field, then compare the generated multipart request with RFC 1341. Done means the Content-Type boundary is declared, each separator uses the boundary with two leading hyphens, and the closing delimiter has two leading and two trailing hyphens.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.