Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3445

Adding headers to a list of EntityPart is not handled correctly in the writer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.2.8.Final, 7.0.0.Alpha1
    • None
    • None
    • None

      As reported on PR https://github.com/resteasy/resteasy/pull/4011/, when a List of type EntityPart is processed through the MultipartEntityPartWriter the headers are not correctly added. The method to create the MultipartFormDataOutput looks like:

      private static MultipartFormDataOutput create(final List<EntityPart> entityParts) {
          final MultipartFormDataOutput output = new MultipartFormDataOutput();
          for (EntityPart entityPart : entityParts) {
              final OutputPart part = output.addFormData(entityPart.getName(), entityPart.getContent(), entityPart.getMediaType(),
                      entityPart.getFileName()
                              .orElse(null));
              entityPart.getHeaders().forEach((name, value) -> part.getHeaders().addAll(name, value));
          }
          return output;
      }
      

      However, the MultivalueMap.addAll(String, Object...) is invoked instead of MultivalueMap.addAll(String, List). This causes the value to be the value of List.toString() instead of each value being added.

              jperkins-rhn James Perkins
              jperkins-rhn James Perkins
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: