Skip to content

Support additional HTTP methods in sendRequest function #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ public function generateSignature(string $data): string
);
}

public function sendRequest(string $method, array $attributes): string
public function sendRequest(string $path, array $attributes, string $method = 'POST'): string
{
$request = $this->makeRequest($method, $attributes);
$request = $this->makeRequest($path, $attributes, $method);

try {
$response = $this->solidGateApiClient->send($request);
Expand Down Expand Up @@ -264,7 +264,7 @@ protected function generateEncryptedFormData(array $attributes): string
return $this->base64UrlEncode($iv . $encrypt);
}

protected function makeRequest(string $path, array $attributes): Request
protected function makeRequest(string $path, array $attributes, string $method = 'POST'): Request
{
$body = json_encode($attributes);

Expand All @@ -275,6 +275,6 @@ protected function makeRequest(string $path, array $attributes): Request
'Signature' => $this->generateSignature($body),
];

return new Request('POST', $path, $headers, $body);
return new Request($method, $path, $headers, $body);
}
}