use of com.koushikdutta.async.http.AsyncHttpPost in project AndroidAsync by koush.
the class HttpServerTests method testJSONObject.
public void testJSONObject() throws Exception {
JSONObject json = new JSONObject();
json.put("foo", "bar");
JSONObjectBody body = new JSONObjectBody(json);
AsyncHttpPost post = new AsyncHttpPost("http://localhost:5000/echo");
post.setBody(body);
json = AsyncHttpClient.getDefaultInstance().executeJSONObject(post, null).get();
assertEquals(json.getString("foo"), "bar");
}
use of com.koushikdutta.async.http.AsyncHttpPost in project AndroidAsync by koush.
the class XHRPollingTransport method postMessage.
private void postMessage(String message) {
if (!message.startsWith("5"))
return;
AsyncHttpRequest request = new AsyncHttpPost(computedRequestUrl());
request.setBody(new StringBody(message));
client.executeString(request, null);
}
use of com.koushikdutta.async.http.AsyncHttpPost in project simperium-android by Simperium.
the class AsyncAuthClient method buildRequest.
public AsyncHttpPost buildRequest(String path, JSONObject body) {
Uri uri = buildUri(path);
AsyncHttpPost request = new AsyncHttpPost(uri);
request.setBody(new JSONObjectBody(body));
request.setHeader(API_KEY_HEADER_NAME, mSecret);
return request;
}
Aggregations