feign-form icon indicating copy to clipboard operation
feign-form copied to clipboard

decorating JacksonEncoder ignores

Open GoodBoy962 opened this issue 5 years ago • 2 comments

While trying to use FormEncoder with JacksonEncoder encoder faced with ignoring 2nd one.

Wrapping JAX-RS with Feign

Feign.builder()
                .encoder(new FormEncoder(new JacksonEncoder()))
                .decoder(new JacksonDecoder())
                .contract(new JAXRSContract())
                .logger(new FeignSlf4jMultilineLogger(ApiClient.class))
                .logLevel(Logger.Level.FULL)
                .target(ApiClient.class, address);

JAX-RS service

public interface ApiClient {

    @POST
    @Path("/token/")
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    Response getAccessToken(@HeaderParam("Authorization") String authSecret, Request request);
}

Request

@Getter
@Setter
public class Request {
    @JsonProperty("client_id")
    private String clientId;
    @JsonProperty("scope")
    private String scope;
    @JsonProperty("grant_type")
    private String grantType;

Request sends with grantType=something&scope=something&clientId=11111

What should we add not to ignore JsonProperty annotations?

GoodBoy962 avatar Aug 20 '20 13:08 GoodBoy962

Have you tried @FormProperty("client_id")?

alexyakovlev90 avatar Aug 21 '20 06:08 alexyakovlev90

can be connected with:: #95

slawekjaranowski avatar Oct 09 '20 06:10 slawekjaranowski