Feign Client does not resolve Query parameter

Bee :

Here is my interface.

public interface SCIMServiceStub {

    @RequestLine("GET /Users/{id}")
    SCIMUser getUser(@Param("id") String id);

    @RequestLine("GET /Groups?filter=displayName+Eq+{roleName}")
    SCIMGroup isValidRole(@Param("roleName") String roleName);

}

Here getUser call works fine. But isValidRole is not working properly as the request is eventually sent like this.

/Groups?filter=displayName+Eq+{roleName}"

Here {roleName} is not resolved. What am I missing here? Appreciate some help, as I'm clueless at this point.

Edit: 1 more question: Is there a way to avoid automatic url encoding of query parameters?

yongsung.yoon :

It seems to be caused by a bug that is already opened - https://github.com/OpenFeign/feign/issues/424

Like in comments, you can define your own Param.Expander something like below as a workaround.

@RequestLine("GET /Groups?filter={roleName}")
String isValidRole(@Param(value = "roleName", expander = PrefixExpander.class) String roleName);

static final class PrefixExpander implements Param.Expander {
    @Override
    public String expand(Object value) {
        return "displayName+Eq+" + value;
    }
}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=465767&siteId=1