I have a Feign client to access to an createUser endpoint that requires two headers: username and password. I know how to add one header, but how do I add two headers to the request?
@FeignClient(name = "client", url = "https://abc.abc.com/user/", configuration = FeignClientConfig.class)
public interface MyFeignClient {
@Headers("username_header: {username}") // how do I add "password" here.
@PostMapping(value = "v1/users")
void createUser((@Param("username") String username, User userRequest);
}
Update: Now based on the answer below, I changed the interface body to:
@Headers({"username_header: {username}", "password_header: {password}"})
@PostMapping(value = "v1/users")
void createUser(@Param("username") String username,
@Param("password") String password,
User userRequest);
And the code that calls it is:
feignClient.createUser("me", "123", userObj);
Then I am getting an error:
org.springframework.beans.factory.BeanCreationException: Error creating bean,
nested exception is java.lang.IllegalStateException: Method has too many Body parameters:
feignClient.createUser(java.lang.String,java.lang.String, User)