-
Notifications
You must be signed in to change notification settings - Fork 82
How can i upload multi file. #68
Comments
@JokerSun the feature was broken, but I've already fixed it in the new version 3.8.0 Take a look at those client examples 1 and 2. There is an example of the server side Your sample with several |
@xxlabaza Thanks for your supporting, i got the example and my question isn't just that , according to the protocol of multipart-form/data carrying either named parameters in request body is allowed, so how can i construct a interface like that
then i hope it will be send like that
Is there a solution? |
不需要重写Contract啊。但是feign默认使用的是SpringMVC 的Contract。 |
@jianguyuxing 谢谢您在百忙之中抽空回复,我知道我的写法现有的contract不支持,但是我是希望实现这种需求,因为这样的写法能够更好的表达这个接口的行为,并且能够跟spring mvc的写法保持一致。您的例子我看了,确实可以实现功能,但是使用的是feign的原生注解,这样就和我们公司现有的代码风格产生冲突。我会抽时间把我的想法实现出来,然后再与您交流。 |
Так, на сколько я вижу вы тут сами уже во всём разобрались... |
Ok. I see, that this issue is closed, but I'll describe here a little workaround. I hope this will help someone. I resolve this in the issue, when I's trying to send something like this via feign client:
In case of two request parts, when tries create feign client instance Method has too many Body parameters occurs. So I do this in such way, that I create two interface API.
I'm using this with feign client configuration
and with fix from PR: #97 - it's needed, if for one field name (here attachments) we'd like send more than one multipart-file. Then, if we'd like to use upload via feign client, we should call upload and create named multiparts.
In this way multi part files names are used as field names. This will be recognized by controller and assigned to dedicated argues. |
In my case , i want to upload multi file ,but i get exception
java.lang.IllegalStateException: Method has too many Body parameters
,my code like thatThe text was updated successfully, but these errors were encountered: