fix bug in header name

This commit is contained in:
2025-04-15 11:51:34 -04:00
parent 0c04500fc2
commit 89cda0d210
2 changed files with 3 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ public class NetworkConstants {
public static final String PARAM_EXPIRY_HOURS = "expiry_hours";
// Authentication
public static final String CLIENT_KEY_HEADER = "client-key";
public static final String CLIENT_KEY_HEADER = "X-Client-Key";
// Default values
public static final int DEFAULT_MAX_DOWNLOADS = 1;

View File

@@ -109,6 +109,7 @@ public class UploadController {
String clientKey = PreferencesUtil.getClientKey(context);
Log.d(TAG, "Using server URL: " + serverUrl);
Log.d(TAG, "Adding header '" + NetworkConstants.CLIENT_KEY_HEADER + "' with value: " + clientKey);
// Build request with client-key header
Request request = new Request.Builder()
@@ -159,6 +160,7 @@ public class UploadController {
if (response.code() == 401 || response.code() == 403) {
errorMsg = "Authentication failed. Please check client key.";
Log.e(TAG, "Authentication error: " + response.code() + ", Body: " + errorBody);
Log.e(TAG, "Header sent: " + NetworkConstants.CLIENT_KEY_HEADER + ": " + clientKey);
} else {
errorMsg = "Upload failed, Response code: " + response.code();
Log.e(TAG, errorMsg + ", Body: " + errorBody);