1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-12 10:23:16 +03:00

Merge pull request #1025 from baldur/master

okcurl truncates values of headers with timestamp values
This commit is contained in:
Jesse Wilson
2014-10-04 18:41:31 -04:00
2 changed files with 7 additions and 1 deletions

View File

@@ -218,7 +218,7 @@ public class Main extends HelpOption implements Runnable {
if (headers != null) {
for (String header : headers) {
String[] parts = header.split(":", -1);
String[] parts = header.split(":", 2);
request.header(parts[0], parts[1]);
}
}

View File

@@ -84,6 +84,12 @@ public class MainTest {
assertNull(request.body());
}
@Test public void headerSplitWithDate() {
Request request = fromArgs("-H", "If-Modified-Since: Mon, 18 Aug 2014 15:16:06 GMT",
"http://example.com").createRequest();
assertEquals("Mon, 18 Aug 2014 15:16:06 GMT", request.header("If-Modified-Since"));
}
private static String bodyAsString(RequestBody body) {
try {
Buffer buffer = new Buffer();