Skip to content

Commit 26af1cf

Browse files
committed
Allow AsynchttpRequest to specify the initial headers. Should I be dumping the header defaults into them?
1 parent 8eddab1 commit 26af1cf

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

AndroidAsync/.classpath

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="src" path="src"/>
4-
<classpathentry kind="src" path="gen"/>
53
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
64
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
75
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
6+
<classpathentry kind="src" path="src"/>
7+
<classpathentry kind="src" path="gen"/>
88
<classpathentry kind="output" path="bin/classes"/>
99
</classpath>

AndroidAsync/AndroidAsync.iml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
<component name="FacetManager">
44
<facet type="android" name="Android">
55
<configuration>
6-
<option name="SELECTED_BUILD_VARIANT" value="debug" />
7-
<option name="ASSEMBLE_TASK_NAME" value="bundleDebug" />
8-
<option name="ALLOW_USER_CONFIGURATION" value="false" />
9-
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
10-
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
116
<option name="LIBRARY_PROJECT" value="true" />
127
<notImportedProperties>
138
<property>MANIFEST_FILE_PATH</property>
@@ -54,6 +49,7 @@
5449
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/rs" isTestSource="true" />
5550
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/res" isTestSource="true" />
5651
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/resources" isTestSource="true" />
52+
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
5753
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
5854
<excludeFolder url="file://$MODULE_DIR$/build/apk" />
5955
<excludeFolder url="file://$MODULE_DIR$/build/assets" />

AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpRequest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,15 @@ public AsyncHttpRequest setMethod(String method) {
8989
}
9090

9191
public AsyncHttpRequest(URI uri, String method) {
92+
this(uri, method, null);
93+
}
94+
95+
public AsyncHttpRequest(URI uri, String method, RawHeaders headers) {
9296
assert uri != null;
9397
mMethod = method;
98+
if (headers == null)
99+
headers = new RawHeaders();
100+
mRawHeaders = headers;
94101
mHeaders = new RequestHeaders(uri, mRawHeaders);
95102
mRawHeaders.setStatusLine(getRequestLine().toString());
96103
mHeaders.setHost(uri.getHost());
@@ -148,7 +155,8 @@ public AsyncHttpRequestBody getBody() {
148155
public void onHandshakeException(AsyncSSLException e) {
149156
}
150157

151-
int mTimeout = 30000;
158+
public static final int DEFAULT_TIMEOUT = 30000;
159+
int mTimeout = DEFAULT_TIMEOUT;
152160
public int getTimeout() {
153161
return mTimeout;
154162
}

0 commit comments

Comments
 (0)