mirror of
https://codeberg.org/reflect/reflect-client-php.git
synced 2025-09-14 10:03:41 +02:00
Compare commits
No commits in common. "master" and "3.0.4" have entirely different histories.
2 changed files with 3 additions and 21 deletions
16
README.md
16
README.md
|
@ -137,19 +137,3 @@ Example:
|
||||||
```php
|
```php
|
||||||
$client->call("my/endpoint")->params(["foo" => "bar"])->delete();
|
$client->call("my/endpoint")->params(["foo" => "bar"])->delete();
|
||||||
```
|
```
|
||||||
|
|
||||||
### `OPTIONS` Request
|
|
||||||
|
|
||||||
Make an `OPTIONS` request by chaining `options()` at the end of a method chain. This method will return a `Reflect\Response` object.
|
|
||||||
|
|
||||||
Use this method to query Reflect for available request methods.
|
|
||||||
|
|
||||||
```php
|
|
||||||
Client->options(): Reflect\Response;
|
|
||||||
```
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```php
|
|
||||||
$client->call("my/endpoint"))->options();
|
|
||||||
```
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
if ($this->key) {
|
if ($this->key) {
|
||||||
$this->headers["Authorization"] = "Bearer {$this->key}";
|
$this->headers["Authorization"] = "Bearer {$this->key}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Construct HTTP headers string from array
|
// Construct HTTP headers string from array
|
||||||
$headers = array_map(fn(string $k, string $v): string => "{$k}: {$v}\r\n", array_keys($this->headers), array_values($this->headers));
|
$headers = array_map(fn(string $k, string $v): string => "{$k}: {$v}\r\n", array_keys($this->headers), array_values($this->headers));
|
||||||
|
@ -134,10 +135,7 @@
|
||||||
|
|
||||||
public function delete(?array $payload = []): Response {
|
public function delete(?array $payload = []): Response {
|
||||||
$this->set_request_body($payload);
|
$this->set_request_body($payload);
|
||||||
|
print_r($this->headers);
|
||||||
return new Response(...$this->http_call(Method::DELETE));
|
return new Response(...$this->http_call(Method::DELETE));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public function options(): Response {
|
|
||||||
return new Response(...$this->http_call(Method::OPTIONS));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue