Skip to content

Commit a87843c

Browse files
committed
Handling delete RequestParams in SyncHttpClient
1 parent e6d72f4 commit a87843c

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

library/src/com/loopj/android/http/AsyncHttpClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,10 @@ private HttpEntity paramsToEntity(RequestParams params, AsyncHttpResponseHandler
896896
return entity;
897897
}
898898

899+
public boolean isUrlEncodingEnabled(){
900+
return isUrlEncodingEnabled;
901+
}
902+
899903
/**
900904
* Applicable only to HttpRequest methods extending HttpEntityEnclosingRequestBase, which is for example not DELETE
901905
*

library/src/com/loopj/android/http/SyncHttpClient.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.os.Message;
55

66
import org.apache.http.HttpEntity;
7+
import org.apache.http.HttpResponse;
78
import org.apache.http.client.methods.HttpUriRequest;
89
import org.apache.http.impl.client.DefaultHttpClient;
910
import org.apache.http.protocol.HttpContext;
@@ -19,15 +20,15 @@ public abstract class SyncHttpClient extends AsyncHttpClient {
1920
protected AsyncHttpResponseHandler responseHandler = new AsyncHttpResponseHandler() {
2021

2122
@Override
22-
protected void sendResponseMessage(org.apache.http.HttpResponse response) {
23+
protected void sendResponseMessage(HttpResponse response) {
2324
responseCode = response.getStatusLine().getStatusCode();
2425
super.sendResponseMessage(response);
2526
}
2627

2728
@Override
2829
protected void sendMessage(Message msg) {
2930
/*
30-
* Dont use the handler and send it directly to the analysis
31+
* Dont use the handler and send it directly to the analysis
3132
* (because its all the same thread)
3233
*/
3334
handleMessage(msg);
@@ -63,7 +64,7 @@ protected void sendRequest(DefaultHttpClient client,
6364
}
6465

6566
/*
66-
* will execute the request directly
67+
* will execute the request directly
6768
*/
6869
new AsyncHttpRequest(client, httpContext, uriRequest, responseHandler)
6970
.run();
@@ -73,13 +74,12 @@ protected void sendRequest(DefaultHttpClient client,
7374

7475
public void delete(String url, RequestParams queryParams,
7576
AsyncHttpResponseHandler responseHandler) {
76-
// TODO what about query params??
77-
delete(url, responseHandler);
77+
delete(getUrlWithQueryString(isUrlEncodingEnabled(), url, queryParams), responseHandler);
7878
}
7979

8080
public String get(String url, RequestParams params) {
8181
this.get(url, params, responseHandler);
82-
/*
82+
/*
8383
* the response handler will have set the result when this line is
8484
* reached
8585
*/
@@ -101,7 +101,7 @@ public String put(String url) {
101101
return result;
102102
}
103103

104-
public String post(String url, HttpEntity entity){
104+
public String post(String url, HttpEntity entity) {
105105
this.post(null, url, entity, null, responseHandler);
106106
return result;
107107
}

0 commit comments

Comments
 (0)