Skip to content

Commit aa326cb

Browse files
feat: network headers impl
1 parent d2e9062 commit aa326cb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sdk-java/src/main/java/ly/count/sdk/java/internal/Transport.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ HttpURLConnection connection(final Request request) throws IOException {
149149
https.setSSLSocketFactory(sslContext.getSocketFactory());
150150
}
151151

152+
if (config.getCustomNetworkRequestHeaders() != null) {
153+
//if there are custom header values, add them
154+
L.v("[Transport] connection, Adding [" + config.getCustomNetworkRequestHeaders() + "] custom header fields");
155+
for (Map.Entry<String, String> entry : config.getCustomNetworkRequestHeaders().entrySet()) {
156+
String key = entry.getKey();
157+
String value = entry.getValue();
158+
if (key != null && value != null && !key.isEmpty()) {
159+
connection.addRequestProperty(key, value);
160+
}
161+
}
162+
}
163+
152164
if (!usingGET) {
153165
OutputStream output = null;
154166
PrintWriter writer = null;

0 commit comments

Comments
 (0)