Skip to content

Commit

Permalink
update user agent (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlin09 authored Nov 6, 2024
1 parent a8db448 commit 7ba17a8
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ public static Consumer<HttpHeaders> getJsonContentHeaders(String apiKey, String
headers.setBearerAuth(apiKey);
headers.set(HEADER_OPENAPI_SOURCE, SOURCE_FLAG);

String userAgent = String.format("%s/%s; java/%s; platform/%s; processor/%s", SDK_FLAG, "1.0.0",
System.getProperty("java.version"), System.getProperty("os.name"), System.getProperty("os.arch"));
headers.set("user-agent", userAgent);
headers.set("user-agent", userAgent());
if (workspaceId != null) {
headers.set(HEADER_WORK_SPACE_ID, workspaceId);
}
Expand All @@ -57,11 +55,6 @@ public static Consumer<HttpHeaders> getJsonContentHeaders(String apiKey, String
};
}

public static String userAgent() {
return String.format("dashscope/%s; java/%s; platform/%s; processor/%s", "\"2.15.1\"",
System.getProperty("java.version"), System.getProperty("os.name"), System.getProperty("os.arch"));
}

public static Map<String, String> getMapContentHeaders(String apiKey, boolean isSecurityCheck, String workspace,
Map<String, String> customHeaders) {
Map<String, String> headers = new HashMap<>();
Expand Down Expand Up @@ -119,4 +112,9 @@ public static Consumer<HttpHeaders> getFileUploadHeaders(Map<String, String> inp
};
}

private static String userAgent() {
return String.format("%s/%s; java/%s; platform/%s; processor/%s", SDK_FLAG, "1.0.0",
System.getProperty("java.version"), System.getProperty("os.name"), System.getProperty("os.arch"));
}

}

0 comments on commit 7ba17a8

Please sign in to comment.