Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ private LDValue[] getEventsFromLastRequest(MockWebServer server, int expectedCou
RecordedRequest r = server.takeRequest();
assertEquals("POST", r.getMethod());
assertEquals("/mobile/events/bulk", r.getPath());
assertEquals(LDUtil.AUTH_SCHEME + mobileKey, r.getHeader("Authorization"));
assertEquals(mobileKey, r.getHeader("Authorization"));
String body = r.getBody().readUtf8();
System.out.println(body);
LDValue[] events = GsonHelpers.gsonInstance().fromJson(body, LDValue[].class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public HttpConfiguration build(ClientContext clientContext) {
LDLogger logger = clientContext.getBaseLogger();
// Build the default headers
Map<String, String> headers = new HashMap<>();
headers.put("Authorization", LDUtil.AUTH_SCHEME + clientContext.getMobileKey());
headers.put("Authorization", clientContext.getMobileKey());
headers.put("User-Agent", LDUtil.USER_AGENT_HEADER_VALUE);
String tagHeader = LDUtil.applicationTagHeader(
clientContext.getEnvironmentReporter().getApplicationInfo(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
* Various utility functions
*/
public class LDUtil {
static final String AUTH_SCHEME = "api_key ";
static final String USER_AGENT_HEADER_VALUE = LDPackageConsts.SDK_CLIENT_NAME + "/" + BuildConfig.VERSION_NAME;

static <T> Callback<T> noOpCallback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class HttpConfigurationBuilderTest {

private static Map<String, String> buildBasicHeaders() {
Map<String, String> ret = new HashMap<>();
ret.put("Authorization", LDUtil.AUTH_SCHEME + MOBILE_KEY);
ret.put("Authorization", MOBILE_KEY);
ret.put("User-Agent", LDUtil.USER_AGENT_HEADER_VALUE);
ret.put("X-LaunchDarkly-Tags", "application-id/" + LDPackageConsts.SDK_NAME + " application-name/" + LDPackageConsts.SDK_NAME
+ " application-version/" + BuildConfig.VERSION_NAME + " application-version-name/" + BuildConfig.VERSION_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void headersForEnvironment() {
);
assertEquals(3, headers.size());
assertEquals(LDUtil.USER_AGENT_HEADER_VALUE, headers.get("user-agent"));
assertEquals("api_key test-key", headers.get("authorization"));
assertEquals("test-key", headers.get("authorization"));
}

@Test
Expand All @@ -106,15 +106,15 @@ public void headersForEnvironmentWithTransform() {
null, null, null, null, null, new EnvironmentReporterBuilder().build(), null);

expected.put("User-Agent", LDUtil.USER_AGENT_HEADER_VALUE);
expected.put("Authorization", "api_key test-key");
expected.put("Authorization", "test-key");
expected.put("X-LaunchDarkly-Tags", "application-id/" + LDPackageConsts.SDK_NAME + " application-name/" + LDPackageConsts.SDK_NAME +
" application-version/" + BuildConfig.VERSION_NAME + " application-version-name/" + BuildConfig.VERSION_NAME);
Map<String, String> headers = headersToMap(
LDUtil.makeHttpProperties(clientContext).toHeadersBuilder().build()
);

assertEquals(3, headers.size());
assertEquals("api_key test-key, more", headers.get("authorization"));
assertEquals("test-key, more", headers.get("authorization"));
assertEquals("value", headers.get("new"));
}

Expand Down
Loading