-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2757 from dimagi/dv/api_versioning
Providing API version header from server to caller when available.
- Loading branch information
Showing
5 changed files
with
45 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
import android.content.Context; | ||
|
||
import com.google.common.collect.ArrayListMultimap; | ||
import com.google.common.collect.Multimap; | ||
|
||
import org.commcare.CommCareApplication; | ||
|
@@ -29,8 +28,7 @@ | |
* @author Phillip Mates ([email protected]) | ||
*/ | ||
public class ModernHttpTask | ||
extends CommCareTask<Void, Void, Void, HttpResponseProcessor> | ||
implements ResponseStreamAccessor { | ||
extends CommCareTask<Void, Void, Void, HttpResponseProcessor> { | ||
|
||
public static final int SIMPLE_HTTP_TASK_ID = 11; | ||
|
||
|
@@ -62,7 +60,7 @@ public ModernHttpTask(Context context, String url, Multimap<String, String> para | |
method, | ||
authInfo, | ||
null, | ||
method.equals(HTTPMethod.GET) ? true : false); | ||
method.equals(HTTPMethod.GET)); | ||
} | ||
|
||
@Override | ||
|
@@ -75,6 +73,7 @@ protected Void doTaskBackground(Void... params) { | |
} catch (IOException e) { | ||
mException = e; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
|
@@ -89,7 +88,17 @@ protected void deliverResult(HttpResponseProcessor httpResponseProcessor, | |
ModernHttpRequester.processResponse( | ||
httpResponseProcessor, | ||
mResponse.code(), | ||
this); | ||
new ResponseStreamAccessor() { | ||
@Override | ||
public InputStream getResponseStream() { | ||
return responseDataStream; | ||
} | ||
|
||
@Override | ||
public String getApiVersion() { | ||
return requester.getApiVersion(); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
|
@@ -102,9 +111,4 @@ protected void deliverUpdate(HttpResponseProcessor httpResponseProcessor, | |
protected void deliverError(HttpResponseProcessor httpResponseProcessor, | ||
Exception e) { | ||
} | ||
|
||
@Override | ||
public InputStream getResponseStream() { | ||
return responseDataStream; | ||
} | ||
} |