Proper way to post json with Fuel.post
See original GitHub issueI created a list of pair and converted it to a json string. I have setted up a node server for reading the request body and the result is:
{ '{"first":"text","second":"hello"},{"first":"id","second":"djahduhdiwd"}': '' }
The whole json is interpretated as the key of the object I’m using Android with vanilla Java
List<Pair> requestParams = new ArrayList<Pair>(2);
requestParams.add( new Pair("text", "hello") );
requestParams.add( new Pair("id", "djahduhdiwd") );
String jsonString = new Gson().toJson(requestParams);
Fuel.post("http://192.168.0.90:9000/article").body(jsonString, Charset.forName("UTF-8")).responseString(new Handler<String>() {
@Override
public void failure(Request request, Response response, FuelError error) {}
@Override
public void success(Request request, Response response, String data) {
Log.v("MainActivity", data);
}
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Proper way to post json with Fuel.post · Issue #135 · kittinunf/fuel
I created a list of pair and converted it to a json string. I have setted up a node server for reading the...
Read more >Kotlin - Fuel - Documentation - GitBook
HttpClient converts PATCH requests to a POST request and adds a X-HTTP-Method-Override: PATCH header. While this is a semi-standard industry ...
Read more >Fuel HTTP Library with Kotlin - Baeldung
We can make POST requests in the same way as for GET, using httpPost() or using the post() method of the Fuel class:...
Read more >kotlin - post request with multiple header information using fuel
Try executing that request manually. Use fiddler/postman/your preferred HTTP client. Maybe you're missing something in the body or headers?
Read more >handeling json input::post in a rest controller - FuelPHP
Hi everybody .. What I would like is to use the data and save it into my database .. shouldn't be that difficult...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is the snippet that I use to do
POST
.Can you try out and see whether you can use it like that?
I used Java HttpUrlConnection instead of the module