Skip to content

Commit 8dfc3d5

Browse files
committed
chore: fix encoding value
Signed-off-by: shuiyisong <xixing.sys@gmail.com>
1 parent 8b8c6f1 commit 8dfc3d5

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

ingester-protocol/src/main/java/io/greptime/BulkWriteClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private BulkStreamWriter bulkStreamWriteTo(
132132
ctx.entrySet().forEach(e -> headers.insert(e.getKey(), String.valueOf(e.getValue())));
133133
headers.insert(Keys.Headers.GREPTIMEDB_DBNAME, database);
134134
if (authInfo != null) {
135-
headers.insert(Keys.Headers.GREPTIMEDB_AUTH, authInfo.toBase64());
135+
headers.insert(Keys.Headers.GREPTIMEDB_AUTH, authInfo.base64HeaderValue());
136136
}
137137
HeaderCallOption headerOption = new HeaderCallOption(headers);
138138
AsyncExecCallOption execOption = new AsyncExecCallOption(this.asyncPool);

ingester-protocol/src/main/java/io/greptime/models/AuthInfo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public static AuthInfo noAuthorization() {
5454
*
5555
* @return the base64 encoded string
5656
*/
57-
public String toBase64() {
58-
String authInfoStr = String.format("Basic %s:%s", this.username, this.password);
59-
return Base64.getEncoder().encodeToString(authInfoStr.getBytes(StandardCharsets.UTF_8));
57+
public String base64HeaderValue() {
58+
String encoded = Base64.getEncoder().encodeToString(String.format("%s:%s", this.username, this.password).getBytes(StandardCharsets.UTF_8));
59+
return String.format("Basic %s", encoded);
6060
}
6161

6262
@Override

0 commit comments

Comments
 (0)