@@ 81-91 (lines=11) @@ | ||
78 | * |
|
79 | * @return Response |
|
80 | */ |
|
81 | public function post($url, array $data = [], array $headers = []) |
|
82 | { |
|
83 | $this->unsetOption(CURLOPT_HTTPGET); |
|
84 | ||
85 | $this->setOptions([ |
|
86 | CURLOPT_CUSTOMREQUEST => 'POST', |
|
87 | CURLOPT_POST => true |
|
88 | ]); |
|
89 | ||
90 | return $this->send($url, $data, $headers); |
|
91 | } |
|
92 | ||
93 | /** |
|
94 | * Send PUT request |
|
@@ 102-109 (lines=8) @@ | ||
99 | * |
|
100 | * @return Response |
|
101 | */ |
|
102 | public function put($url, array $data = [], array $headers = []) |
|
103 | { |
|
104 | $this->unsetOptions([CURLOPT_HTTPGET, CURLOPT_POST]); |
|
105 | ||
106 | $this->setOption(CURLOPT_CUSTOMREQUEST, 'PUT'); |
|
107 | ||
108 | return $this->send($url, $data, $headers); |
|
109 | } |
|
110 | ||
111 | /** |
|
112 | * Send PATCH request |
|
@@ 120-127 (lines=8) @@ | ||
117 | * |
|
118 | * @return Response |
|
119 | */ |
|
120 | public function patch($url, array $data = [], array $headers = []) |
|
121 | { |
|
122 | $this->unsetOptions([CURLOPT_HTTPGET, CURLOPT_POST]); |
|
123 | ||
124 | $this->setOption(CURLOPT_CUSTOMREQUEST, 'PATCH'); |
|
125 | ||
126 | return $this->send($url, $data, $headers); |
|
127 | } |
|
128 | ||
129 | /** |
|
130 | * Send DELETE request |
|
@@ 138-145 (lines=8) @@ | ||
135 | * |
|
136 | * @return Response |
|
137 | */ |
|
138 | public function delete($url, array $data = [], array $headers = []) |
|
139 | { |
|
140 | $this->unsetOptions([CURLOPT_HTTPGET, CURLOPT_POST]); |
|
141 | ||
142 | $this->setOption(CURLOPT_CUSTOMREQUEST, 'DELETE'); |
|
143 | ||
144 | return $this->send($url, $data, $headers); |
|
145 | } |
|
146 | ||
147 | /** |
|
148 | * Set or overwrite a cURL option |