How To Handle Jsonsyntaxexception When Receiving Response From Gae
I am trying to replicate the Google App Engine Servlets module here using Retrofit instead of AsyncTask. I find it odd, but apparently Retrofit 2.0 does not support connections to
Solution 1:
The problem here is that you are trying to send a POST with the "name" parameter as a @Query
, when you should be sending as a @Field
.
try the method like this:
@FormUrlEncoded@POST("/hello")
void testRequest(@Field("name") String name, Callback<String> cb);
Solution 2:
You're returning a plain text response, and from the error message I assume Retrofit expects a JSON formatted response. Either:
try changing
resp.setContentType("text/plain");
toresp.setContentType("application/json");
and change the content to JSON formator check this question to read the string from the response: Retrofit callback get response body
Post a Comment for "How To Handle Jsonsyntaxexception When Receiving Response From Gae"