Skip to content

Commit a848e70

Browse files
committed
fix: address comment
1 parent e176a10 commit a848e70

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/main/java/dev/openfga/sdk/api/BaseStreamingApi.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,16 @@ protected HttpRequest buildHttpRequest(String method, String path, Object body,
168168
byte[] bodyBytes = objectMapper.writeValueAsBytes(body);
169169
HttpRequest.Builder requestBuilder = ApiClient.requestBuilder(method, path, bodyBytes, configuration);
170170

171-
// Apply request interceptors if any
172-
var interceptor = apiClient.getRequestInterceptor();
173-
if (interceptor != null) {
174-
interceptor.accept(requestBuilder);
175-
}
176-
177171
// Attach authorization header if credentials are configured
178-
// Applied after interceptors to avoid duplicate headers
179172
String accessToken = apiClient.getAccessToken(configuration);
180173
if (accessToken != null) {
181-
requestBuilder.setHeader("Authorization", "Bearer " + accessToken);
174+
requestBuilder.header("Authorization", "Bearer " + accessToken);
175+
}
176+
177+
// Apply request interceptors last so they can override any header
178+
var interceptor = apiClient.getRequestInterceptor();
179+
if (interceptor != null) {
180+
interceptor.accept(requestBuilder);
182181
}
183182

184183
return requestBuilder.build();

0 commit comments

Comments
 (0)