|
|
@@ -37,14 +37,14 @@ public class OssStoreClient {
|
|
|
this.endpoint = endpoint;
|
|
|
}
|
|
|
|
|
|
- public UploadFileRet putObject(File file, int channelCode, int userId) throws Exception {
|
|
|
+ public UploadFileRet putObject(File file, int channelCode, String token) throws Exception {
|
|
|
String sha256sum = DigestUtil.sha256sum(file.getAbsolutePath());
|
|
|
String api = String.format("%s/", endpoint);
|
|
|
HttpRequest.Builder builder = HttpRequest.newBuilder(new URI(api))
|
|
|
.version(HttpClient.Version.HTTP_1_1)
|
|
|
.header("x-content-sha256sum", sha256sum)
|
|
|
.header("x-channel-id", channelCode+"")
|
|
|
- .header("x-user-id", userId+"");
|
|
|
+ .header("authorization", "Bearer " + token);
|
|
|
|
|
|
HttpRequest httpRequest = builder.PUT(HttpRequest.BodyPublishers.ofFile(Path.of(file.getAbsolutePath()))).build();
|
|
|
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|