java - How to build request with custom body -


i'm developing java library interfacing 1 of our legacy system. calls via rest request. body of each request url encoded form.

but here problem, each form has single field contains stringified json object arguments. wonder best practice replicate using retrofit library?

currently i'm thinking defining request as,

@formurlencoded @post("request") call<response> request(@field("payload") string payload);   

and create layer between retrofit , request.

is better solution allows me define request fields relevant given request ie

@formurlencoded @post("request") call<response> request(@field("field1") string field1,                        @field("field2") string field2); 

and pre process them create body required given request


Comments

Popular posts from this blog

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -