Skip to content

MultiPartRepresentation.setBoundary drops the media type's other parameters #1600

Closed

Description

@jlouvel

Problem

MultiPartRepresentation.setBoundary(MediaType, String) drops the media type's other parameters when it already has a boundary parameter. It builds the new media type from the parent type only:

if (mediaType.getParameters().getFirst(PARAMETER_BOUNDARY) != null) {
    result = new MediaType(mediaType.getParent(), PARAMETER_BOUNDARY, boundary);
}

So multipart/mixed; boundary=a; deferSpec=20220824 becomes multipart/mixed; boundary=b, and deferSpec is lost. The instance method setBoundary(String) has the same effect, since it delegates to the static one. When the media type has no boundary yet, the other parameters are kept, so the behavior depends on the input.

Why it matters

Some protocols carry other parameters on multipart types, such as deferSpec for GraphQL incremental delivery and type/start for multipart/related. The new streaming MultipartStreamRepresentation (#1587, #1595) keeps them.

Proposed direction

Replace only the boundary parameter and keep the others in their order. Add a test covering both cases, with and without an existing boundary.

Related

Activity

  1. added 3 commits that reference this issue on Nov 1, 2026
    783fb09
    18e6afc
    274a571
  2. jlouvel commented on Nov 2, 2026

    @jlouvel
    CollaboratorAuthor

    Fixed by #1606, merged into 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions