swagger-api / swagger-api/swagger-ui

Missing start boundary for multipart body

Open
#8,181 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: Linux
  • Browser: Chrome / Firefox
  • Version: 105/104
  • Method of installation: npm
  • Swagger-UI version: using swagger-jaxrs2-jakarta/2.2.2
  • OpenAPI version: OpenAPI 3.0
Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.3
info:
  title: FormData MultiPart Example
  version: 1.0.0
paths:
  /foo:
    post:
      operationId: updatePet
      parameters:
        - name: id
          in: query
          required: true
          schema:
            pattern: ^(?!aliases$)(?!ids$)[-_.a-zA-Z0-9]+$
            type: string
        - name: additionalMetadata
          in: query
          description: Additional Metadata
          required: false
          schema:
            type: string
      requestBody:
        content: 
          multipart/form-data: # Media type
            schema:   
              type: string
              format: binary
      responses:
        '200':
          description: Successful operation
Describe the bug you're encountering

It seems that there is no start boundary set. Chrome Dev Tools also only show the end boundary but no start boundary. This leads to the following exception on the server:

Caused by: org.jvnet.mimepull.MIMEParsingException: Missing start boundary
at org.jvnet.mimepull.MIMEParser.skipPreamble(MIMEParser.java:288)
at org.jvnet.mimepull.MIMEParser.access$300(MIMEParser.java:38)
at org.jvnet.mimepull.MIMEParser$MIMEEventIterator.next(MIMEParser.java:124)
at org.jvnet.mimepull.MIMEParser$MIMEEventIterator.next(MIMEParser.java:102)
at org.jvnet.mimepull.MIMEMessage.makeProgress(MIMEMessage.java:199)
at org.jvnet.mimepull.MIMEMessage.parseAll(MIMEMessage.java:160)
at org.jvnet.mimepull.MIMEMessage.getAttachments(MIMEMessage.java:86)
To reproduce...

Steps to reproduce the behavior:
Just fill out the form and have a look at the request header

Expected behavior

There should be a start boundary set, but there isn't any.

Screenshots

image

Additional context or thoughts

The curl command produced by swagger-ui works as expected, there the start boundary is set.

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

No source file or test is identified. Start with the provided OpenAPI multipart example and the browser request-generation path; compare the generated browser request with the working curl command. Done means the browser request includes a valid multipart start boundary and the server no longer reports a missing boundary.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.