Skip to content

Commit

Permalink
Merge pull request square#234 from square/jw/header-prefix
Browse files Browse the repository at this point in the history
Change custom headers to 'OkHttp-Foo-Bar' format.
  • Loading branch information
JakeWharton committed Jul 4, 2013
2 parents cee52c4 + 27861c6 commit b6a68e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public static Platform get() {
return PLATFORM;
}

/** Prefix used on custom headers. */
public String getPrefix() {
return "OkHttp";
}

public void logW(String warning) {
System.out.println(warning);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.squareup.okhttp.internal.http;

import com.squareup.okhttp.ResponseSource;
import com.squareup.okhttp.internal.Platform;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URI;
Expand All @@ -34,16 +35,16 @@
public final class ResponseHeaders {

/** HTTP header name for the local time when the request was sent. */
private static final String SENT_MILLIS = "X-Android-Sent-Millis";
private static final String SENT_MILLIS = Platform.get().getPrefix() + "-Sent-Millis";

/** HTTP header name for the local time when the response was received. */
private static final String RECEIVED_MILLIS = "X-Android-Received-Millis";
private static final String RECEIVED_MILLIS = Platform.get().getPrefix() + "-Received-Millis";

/** HTTP synthetic header with the response source. */
static final String RESPONSE_SOURCE = "X-Android-Response-Source";
static final String RESPONSE_SOURCE = Platform.get().getPrefix() + "-Response-Source";

/** HTTP synthetic header with the selected transport (spdy/3, http/1.1, etc). */
static final String SELECTED_TRANSPORT = "X-Android-Selected-Transport";
static final String SELECTED_TRANSPORT = Platform.get().getPrefix() + "-Selected-Transport";

private final URI uri;
private final RawHeaders headers;
Expand Down

0 comments on commit b6a68e1

Please sign in to comment.