Permalink
Browse files

Code cleanup.

  • Loading branch information...
1 parent 6489a79 commit 8b53469ca05520108b0ba5d2e484d1afad0e6f9b Andrew Kirilenko committed Mar 21, 2012
Showing with 6 additions and 10 deletions.
  1. +6 −10 client/src/main/java/io/iron/ironworker/client/APIClient.java
@@ -145,7 +145,7 @@ private HttpResponse doRequestExecute(HttpRequestBase request) throws APIExcepti
return response;
}
- private void setRequestURI(HttpRequestBase request, String method, Map<String, String> params) throws APIException {
+ private void setRequestParams(HttpRequestBase request, String method, Map<String, String> params) throws APIException {
List<NameValuePair> qParams = new ArrayList<NameValuePair>();
if (params != null) {
@@ -169,25 +169,21 @@ private void setRequestURI(HttpRequestBase request, String method, Map<String, S
}
request.setURI(uri);
- }
-
- private HttpResponse doRequest(HttpRequestBase request, String method, Map<String, String> params) throws APIException {
- setRequestURI(request, method, params);
- request.addHeader("Content-Type", "application/json");
request.addHeader("Authorization", "OAuth " + token);
request.addHeader("User-Agent", userAgent);
+ }
+
+ private HttpResponse doRequest(HttpRequestBase request, String method, Map<String, String> params) throws APIException {
+ setRequestParams(request, method, params);
return doRequestExecute(request);
}
private HttpResponse doFileRequest(File file, String method, Map<String, String> params) throws APIException {
HttpPost request = new HttpPost();
- setRequestURI(request, method, null);
-
- request.addHeader("Authorization", "OAuth " + token);
- request.addHeader("User-Agent", userAgent);
+ setRequestParams(request, method, null);
MultipartEntity entity = new MultipartEntity();

0 comments on commit 8b53469

Please sign in to comment.