Hi. During implementation found out that default behaviour does not work correctly I am trying to send dto and byte array in one request @PostMapping(path = "/stream", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) void testStreamUpload( @RequestPart("dto") TestDto testDto, @RequestPart("file") FormData file );

though, it does not add dto correctly until I add custom configuration for Feign client:

class Configuration { @Bean public AbstractFormWriter jsonFormWriter() { return new JsonFormWriter(); } }

It starts working BUT all remaining form writers are now skipped in MultipartFormContentProcessor because JsonFormWriter becomes the only suitable writer. изображение

My possible solution is to reimplement JsonFormWriter to work only with my testDto.

full example

Comment From: OlgaMaciaszek

Hello, @kampaii53 feign-form package is not maintained by us. What we do is just add the writer you instantiate as a bean as the first writer in the hierarchy that is being processed. If you do not want to process all the inputs as JSON, you might need to create your own implementation of JsonFormWriter on top of the one provided by us where you will implement the isApplicable method to make sure only the input that matches your conditions is processed as JSON.

Comment From: spring-cloud-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: kampaii53

Hi @OlgaMaciaszek! Sorry I confused you, I was talking about this JsonFormWriter. The issue reproduced here is me trying to send form, which contains both file and json. So, by default(without JsonFormWriter), if the file is attached, JSON is not being sent. If I add JsonFormWriter to a list of applicable writers, it overrides a byte[] writer which is an issue I'm trying to describe

Comment From: OlgaMaciaszek

@kampaii53 Can you also provide a sample multipart file that can be used to reproduce the issue?

Comment From: kampaii53

@kampaii53 Can you also provide a sample multipart file that can be used to reproduce the issue?

@OlgaMaciaszek Hi! I have updated example with files.

how-to: 1. start Application 2. start ClientApplication 3. use postman/test-form.postman_collection.json requests(imort via postman, needed files are in the same directory)

crutch solution is described in ApplicationClient.Configuration. You need to comment jsonFormWriter bean and uncomment enhancedFormWriter. ALSO: multipart+dto is still failing even in crutched solution(file is passed, dto is not)

Comment From: OlgaMaciaszek

@kampaii53 I have updated the sample so that the Feign call gets propagated to a server-side controller so it's easier to test. I have run some tests on the updated sample. I don't really use Postman much, so I've instead just run httpie commands with the files you've provided (find in README and update file paths before running). Everything works fine for me just with the standard JsonFormWriter.

Comment From: kampaii53

retried and checked via tests. seems that was my fault annotating controller method with Param instead of RequestPart. sorry for taking your time

Comment From: OlgaMaciaszek

No problem, @kampaii53. I'm happy the issue was solved.