Skip to content

Commit

Permalink
fixes bug #1519
Browse files Browse the repository at this point in the history
  • Loading branch information
David Senk committed Jan 30, 2024
1 parent 6455fd8 commit 5872e76
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.jclouds.b2.filters;

import java.net.URI;
import java.nio.charset.StandardCharsets;

import javax.inject.Inject;
import javax.inject.Singleton;
Expand Down Expand Up @@ -50,9 +51,11 @@ public HttpRequest filter(HttpRequest request) throws HttpException {
endpoint.getPath() +
(endpoint.getQuery() == null ? "" : "?" + endpoint.getQuery()));

String updatedRequestBody = request.getPayload().getRawContent().toString().replaceAll("\"accountId\":.?\".*\"", "\"accountId\":\"" + auth.accountId() + "\"");
request = request.toBuilder()
.endpoint(endpoint)
.replaceHeader(HttpHeaders.AUTHORIZATION, auth.authorizationToken())
.payload(updatedRequestBody)
.build();
return request;
}
Expand Down

0 comments on commit 5872e76

Please sign in to comment.