Android进行Post提交JSON数据注意事项

刚好业务需要写一个测试程序给客户使用,直接入主题吧!

请求地址:http://12.32.12.32:91889/testx.php

请求参数:

{

    "test1": "顾家家居口味咯咯咯",

    "test2": "把1册",

    "test3": "13512341234",

    "test4": "5rW35Y2X55uR54ux566h55CG5bGA6LCD5bqm5oyH5oyl5bmz5Y",

    "test5": "1234s"

}

使用postman工具直接请求成功,使用写的程序就失败,请关注下面demo程序的红色标注部分!

try {
       JSONObject body = new JSONObject();
       body.put("test1", etText.getText().toString());
       body.put("test2", etName.getText().toString());
       body.put("test3", etPhone.getText().toS

你可能感兴趣的:(Android,感慨,android,java,单元测试)