http-request icon indicating copy to clipboard operation
http-request copied to clipboard

post special json type

Open huigesv123 opened this issue 9 years ago • 2 comments

how to post json like this :

{
    "app_id" : "0.1.10",
    "channel_tag" : "production",
    "device" : {
        "snapshot" : "0.1.10",
        "binary_version" : "0.1.10",
        "platform" : "android"
    }

}

???

huigesv123 avatar Sep 11 '16 13:09 huigesv123

HttpRequest request = HttpRequest.post("http://localhost/").header(HttpRequest.HEADER_CONTENT_TYPE, HttpRequest.CONTENT_TYPE_JSON).send("{\n" +
                "    \"app_id\" : \"0.1.10\",\n" +
                "    \"channel_tag\" : \"production\",\n" +
                "    \"device\" : {\n" +
                "        \"snapshot\" : \"0.1.10\",\n" +
                "        \"binary_version\" : \"0.1.10\",\n" +
                "        \"platform\" : \"android\"\n" +
                "    }\n" +
                "\n" +
                "}");

ProductOfAmerica avatar Mar 02 '17 01:03 ProductOfAmerica

...however a method for HttpRequest.post(url).json(strJson) function would be nice

ProductOfAmerica avatar Mar 02 '17 01:03 ProductOfAmerica