Skip to content

Commit 02ff05b

Browse files
committed
Use X-ClickHouse-User by headers
1 parent 8e4b2b7 commit 02ff05b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Transport/CurlerRequest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,12 @@ public function auth($username, $password)
438438
return $this;
439439
}
440440

441+
public function authByHeaders($username, $password)
442+
{
443+
$this->headers['X-ClickHouse-User'] = $username;
444+
$this->headers['X-ClickHouse-Key'] = $password;
445+
return $this;
446+
}
441447
/**
442448
* @param array|string $data
443449
* @return $this

src/Transport/Http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private function getUrl($params = [])
191191
private function newRequest($extendinfo)
192192
{
193193
$new = new CurlerRequest();
194-
$new->auth($this->_username, $this->_password)
194+
$new->authByHeaders($this->_username, $this->_password)
195195
->POST()
196196
->setRequestExtendedInfo($extendinfo);
197197

0 commit comments

Comments
 (0)