| @@ 38-46 (lines=9) @@ | ||
| 35 | ] + $curl_options; |
|
| 36 | } |
|
| 37 | ||
| 38 | public function get(string $url, array $headers = []): Message |
|
| 39 | { |
|
| 40 | $request = (new Message) |
|
| 41 | ->withType(Message::REQUEST) |
|
| 42 | ->withUrl($url) |
|
| 43 | ->withMethod(Request::GET) |
|
| 44 | ->withHeaders($headers); |
|
| 45 | return $this->http($request); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function postJson(string $url, array $data, array $headers = [], string $method = Request::POST): Message |
|
| 49 | { |
|
| @@ 77-85 (lines=9) @@ | ||
| 74 | return $this->http($request); |
|
| 75 | } |
|
| 76 | ||
| 77 | public function delete(string $url, array $headers = []): Message |
|
| 78 | { |
|
| 79 | $request = (new Message) |
|
| 80 | ->withType(Message::REQUEST) |
|
| 81 | ->withUrl($url) |
|
| 82 | ->withMethod(Request::DELETE) |
|
| 83 | ->withHeaders($headers); |
|
| 84 | return $this->http($request); |
|
| 85 | } |
|
| 86 | ||
| 87 | public function http(Message $request): Message |
|
| 88 | { |
|