- Added Oauth2 authentication. Fixed non-working bearer token also.
This commit is contained in:
1 parent
f035fdf0a2
commit
ce4d6cdf7c
7 files changed
+105
-32
No files matched your search
@@ -27,7 +27,7 @@ abstract class CurlTransport {
|
||||
public ContentTypeEnum $contentType = ContentTypeEnum::Json,
|
||||
# Matching Guzzle's great user-agent syntax
|
||||
public string $userAgent = "ulmus-api/1.0 curl/{curl} php/{php}",
|
||||
public bool $debug = false,
|
||||
public bool $debug = true,
|
||||
) {
|
||||
$this->userAgent = str_replace([ '{curl}', '{php}', ], [ curl_version()['version'] ?? "???", phpversion() ], $this->userAgent);
|
||||
}
|
||||
@@ -77,9 +77,10 @@ abstract class CurlTransport {
|
||||
|
||||
$this->applyMethod($method, $data, $headers, $options);
|
||||
|
||||
$headers += $this->authorization->headers;
|
||||
|
||||
$options += $this->authorization->options;
|
||||
if ($this->authorization) {
|
||||
$headers += HttpHeaderEnum::normalizeHeaderArray($this->authorization->headers);
|
||||
$options += $this->authorization->options;
|
||||
}
|
||||
|
||||
$options += [
|
||||
CURLOPT_URL => $url,
|
||||
@@ -136,6 +137,13 @@ abstract class CurlTransport {
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function getDebugErrorLines() : array
|
||||
{
|
||||
$this->stderr->rewind();
|
||||
|
||||
return explode(PHP_EOL, $this->stderr->getContents());
|
||||
}
|
||||
|
||||
protected function applyMethod(MethodEnum $method, mixed &$data, array &$headers, array &$options) : void
|
||||
{
|
||||
switch ($method) {
|
||||
|
||||
Reference in new issue
Block a user