feign icon indicating copy to clipboard operation
feign copied to clipboard

Feign interprets subclass of Requests.Options as POST payload

Open dinhani opened this issue 4 years ago • 0 comments

I have a class that extends Request.Options so I can pass additional parameters to a custom Feign client.

class CustomOptions(
    val customOption: Int
) : Request.Options()

And in my Feign client I use it like this:

@FeignClient(...)
interface SomeClient {
    fun somePost(@RequestBody payload: SomePayload, customOptions: CustomOptions)
}

It works well with GET methods, but in POST methods, the subclassed option is identified as a duplicated payload because the following piece of code checks only for instances of Request.Options and the creation of the client fails with Method has too many Body parameters.

https://github.com/OpenFeign/feign/blob/52dc2df479a5c4dd60fda8c45cec8d7f0164e349/core/src/main/java/feign/Contract.java#L120

I believe the previous check should also check for subclasses of Request.Options.

dinhani avatar May 18 '21 12:05 dinhani