Skip to content

Commit 9146dec

Browse files
committed
Support more methods
1 parent 3f482d8 commit 9146dec

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Http/Client.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class Client implements ClientInterface
4747
public const METHOD_DELETE = 'DELETE';
4848
public const METHOD_HEAD = 'HEAD';
4949
public const METHOD_PATCH = 'PATCH';
50+
public const METHOD_TRACE = 'TRACE';
5051
public const METHOD_CONNECT = 'CONNECT';
5152
public const METHOD_OPTIONS = 'OPTIONS';
5253

@@ -301,11 +302,24 @@ private function resolveMethod(RequestInterface $request): void
301302
break;
302303
case static::METHOD_PATCH:
303304
$this->options[CURLOPT_CUSTOMREQUEST] = static::METHOD_PATCH;
305+
$this->options[CURLOPT_POSTFIELDS] = $request->getBody()->__toString();
304306
break;
305307
case static::METHOD_HEAD:
306308
$this->options[CURLOPT_CUSTOMREQUEST] = static::METHOD_HEAD;
307309
$this->options[CURLOPT_NOBODY] = true;
308310
break;
311+
case static::METHOD_OPTIONS:
312+
$this->options[CURLOPT_CUSTOMREQUEST] = static::METHOD_OPTIONS;
313+
$this->options[CURLOPT_NOBODY] = true;
314+
break;
315+
case static::METHOD_CONNECT:
316+
$this->options[CURLOPT_CUSTOMREQUEST] = static::METHOD_CONNECT;
317+
$this->options[CURLOPT_NOBODY] = true;
318+
break;
319+
case static::METHOD_TRACE:
320+
$this->options[CURLOPT_CUSTOMREQUEST] = static::METHOD_TRACE;
321+
$this->options[CURLOPT_NOBODY] = true;
322+
break;
309323
default:
310324
throw new RequestException($request, 'Invalid request method', 400);
311325
}

0 commit comments

Comments
 (0)