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

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -