Skip to content

Commit da852f7

Browse files
Merge #835
835: Add check for empty API key before adding Authorization header r=curquiza a=svavassori # Pull Request ## Related issue Fixes #834 ## What does this PR do? - It adds empty string check before adding the `Authorization` header, so to make it consistent with the default apiKey value set by the host-only Config constructor ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Sergio Vavassori <[email protected]>
2 parents cfc07ea + ea84d19 commit da852f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/meilisearch/sdk/http/CustomOkHttpClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private Request buildRequest(HttpRequest request) throws MalformedURLException {
5656
Request.Builder builder = new Request.Builder();
5757
builder.url(url);
5858

59-
if (this.config.getApiKey() != null)
59+
if (this.config.getApiKey() != null && !this.config.getApiKey().isEmpty())
6060
builder.addHeader("Authorization", this.config.getBearerApiKey());
6161

6262
for (Map.Entry<String, String> entry : request.getHeaders().entrySet()) {

0 commit comments

Comments
 (0)