@@ 36-46 (lines=11) @@ | ||
33 | * @param string[] $headers Custom headers |
|
34 | * @return string |
|
35 | */ |
|
36 | public function get(string $uri, array $headers = []) :string |
|
37 | { |
|
38 | $request = new Request(); |
|
39 | $request->setMethod('GET'); |
|
40 | $request->setUri($uri); |
|
41 | $request->setHeaders($headers); |
|
42 | ||
43 | $this->adapter->send($request); |
|
44 | ||
45 | return $this->adapter->getResponse(); |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * Send a post request |
|
@@ 57-68 (lines=12) @@ | ||
54 | * |
|
55 | * @return string |
|
56 | */ |
|
57 | public function post(string $uri, array $headers = [], array $data = []) :string |
|
58 | { |
|
59 | $request = new Request(); |
|
60 | $request->setMethod('POST'); |
|
61 | $request->setUri($uri); |
|
62 | $request->setHeaders($headers); |
|
63 | $request->setBody($data); |
|
64 | ||
65 | $this->adapter->send($request); |
|
66 | ||
67 | return $this->adapter->getResponse(); |
|
68 | } |
|
69 | ||
70 | } |