public class JsonEncoder extends Object implements Encoder
Basic example with Feign.Builder:
interface GitHub {
@RequestLine("POST /repos/{owner}/{repo}/contributors")
JSONObject create( @Param("owner") String owner,
@@Param("repo") String repo,
JSONObject contributor);
}
GitHub github = Feign.builder()
.decoder(new JsonDecoder())
.encoder(new JsonEncoder())
.target(GitHub.class, "https://api.github.com");
JSONObject contributor = new JSONObject();
contributor.put("login", "radio-rogal");
contributor.put("contributions", 0);
github.create("openfeign", "feign", contributor);
Encoder.DefaultMAP_STRING_WILDCARD| Constructor and Description |
|---|
JsonEncoder() |
| Modifier and Type | Method and Description |
|---|---|
void |
encode(Object object,
Type bodyType,
RequestTemplate template) |
public void encode(Object object, Type bodyType, RequestTemplate template) throws EncodeException
encode in interface EncoderEncodeExceptionCopyright © 2012–2023 OpenFeign. All rights reserved.