Eebado
Contributors
Posts: 165
|
Post by Eebado on Oct 29, 2019 21:38:09 GMT
Starting to work with the httpPost() command and am getting some NetworkErrorExceptions. This is the only output I'm getting:
How can I get a more verbose output? Any idea what might be causing the exception? This is the code I'm executing:
Testing the call using PostMan works fine.
|
|
|
Post by AnkuLua on Oct 30, 2019 5:28:23 GMT
What device and Android version?
|
|
Eebado
Contributors
Posts: 165
|
Post by Eebado on Oct 30, 2019 14:05:31 GMT
OnePlus 5, Android 9.0.
|
|
Eebado
Contributors
Posts: 165
|
Post by Eebado on Oct 31, 2019 15:14:57 GMT
I think I may have found the issue, and it may be how I'm communicating with the server.
httpPost puts the param values in as form values, and not as raw JSON data. Is there anyway to change that?
|
|
Eebado
Contributors
Posts: 165
|
Post by Eebado on Oct 31, 2019 15:28:23 GMT
Is there any way to capture the request in order to debug what is being sent? The exception is so generic it's difficult to know if it's thrown before or after the network call even.
|
|
|
Post by AnkuLua on Oct 31, 2019 23:44:23 GMT
Is there any way to capture the request in order to debug what is being sent? The exception is so generic it's difficult to know if it's thrown before or after the network call even. It's in standard http post format. You need to debug on your server. For apache2, go to /var/log/apache2/error.log and check what's going wrong.
|
|
Eebado
Contributors
Posts: 165
|
Post by Eebado on Nov 5, 2019 16:40:26 GMT
ankuluaUser Why the name of Alan Turing are parameters in the httpPost table URL encoded and put into the body as if they were in a GET command??!? Why would you not just serialize the table as a JSON object and put that in the body like any normal programmer would do? When I make the request: What is actually sent to the service is: "param1=paramTest1¶m2=paramTest2¶m3=paramTest3&" Why would you do that? Why not just send a JSON object, like POST commands are built to handle: You even URL encode special characters which is odd. If I try and encode the JSON string myself and put it in the body, what is actually sent is this: Why would you URL encode a post body? Could you explain to me why such API decisions were made?
|
|