Trind
Trind

Reputation: 1599

Post form with Feign

Is it possible to post form data with NetFlix' Feign library?

@RequestLine("POST /progs/dorules/{vsid}/add/{rsid}")
@Body("%7B\"ADD\": \"add\", \"rule\": \"{rule}\"%7D")
void addRule(
        @Param("rule") String name,
        @Param("vsid") String vsid,
        @Param("rsid") String rsid
);

I want the call to look as follows:

POST https://xxxx/progs/dorules/1/add/80

With Parameters: ADD = Add rule = default

With form type : application/x-www-form-urlencoded

Upvotes: 2

Views: 11306

Answers (2)

Tony Murphy
Tony Murphy

Reputation: 751

Feign Form adds support for encoding application/x-www-form-urlencoded and multipart/form-data forms.

https://github.com/OpenFeign/feign-form

If you are calling a Spring MVC application, it's best to use the SpringFormEncoder

Upvotes: 0

Allenaz
Allenaz

Reputation: 1109

You seem to be a @Headers() away: feign doc

Upvotes: 2

Related Questions