Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ion/src/com/koushikdutta/ion/IonRequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ public IonRequestBuilder load(String method, String url) {
return loadInternal(method, url);
}

@Override
public R setMethod(String method) {
methodWasSet = true;
this.method = method;
return this;
}

@Override
public IonRequestBuilder load(String format, String... args) {
return load(String.format(format, args));
}

@Override
public IonRequestBuilder load(AsyncHttpRequest request) {
headers = new Headers(request.getHeaders().getMultiMap());
Expand Down
7 changes: 7 additions & 0 deletions ion/src/com/koushikdutta/ion/builder/LoadBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ public interface LoadBuilder<B> {
*/
public B load(String uri);

/**
* @param format Format string in C's printf style.
* @param args Arguments referenced by the format specifiers in the format string.
* @return
*/
public B load(String format, String... args);

/**
* Load an url using the given an HTTP method such as GET or POST.
* @param method HTTP method such as GET or POST.
Expand Down
7 changes: 7 additions & 0 deletions ion/src/com/koushikdutta/ion/builder/RequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ public interface RequestBuilder<F, R extends RequestBuilder, M extends Multipart
*/
public R setHandler(Handler handler);

/**
* Set the HTTP method explicitly
* @param method HTTP method of the request
* @return
*/
public R setMethod(String method);

/**
* Set a HTTP header
* @param name Header name
Expand Down
11 changes: 11 additions & 0 deletions ion/test/src/com/koushikdutta/ion/test/Issues.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,15 @@ public void testIssue760() throws Exception {
+ "} should be equal to {Pixel(35,200,5): " + Integer.toHexString(frame5Pixel) + "}";
Assert.assertEquals(assertionMessage, frame4Pixel, frame5Pixel);
}

public void testIssue365() throw Exception {
String noFormatting = Ion.with(getContext()).load("https://raw.githubusercontent.com/koush/AndroidAsync/master/AndroidAsync/test/assets/test.json")
.asString().get();
String username = "koush";
String withFormatting = Ion.with(getContext()).load(
"https://raw.githubusercontent.com/%s/AndroidAsync/master/AndroidAsync/test/assets/test.json",
username)
.asString().get();
Assert.asserEquals(noFormatting, withFormatting);
}
}