Skip to content

Commit

Permalink
Merge pull request #424 from clue-labs/body-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus authored Aug 29, 2021
2 parents 29940dc + 6785514 commit b011736
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ offers several methods that resemble the HTTP protocol methods:
```php
$browser->get($url, array $headers = array());
$browser->head($url, array $headers = array());
$browser->post($url, array $headers = array(), string|ReadableStreamInterface $contents = '');
$browser->delete($url, array $headers = array(), string|ReadableStreamInterface $contents = '');
$browser->put($url, array $headers = array(), string|ReadableStreamInterface $contents = '');
$browser->patch($url, array $headers = array(), string|ReadableStreamInterface $contents = '');
$browser->post($url, array $headers = array(), string|ReadableStreamInterface $body = '');
$browser->delete($url, array $headers = array(), string|ReadableStreamInterface $body = '');
$browser->put($url, array $headers = array(), string|ReadableStreamInterface $body = '');
$browser->patch($url, array $headers = array(), string|ReadableStreamInterface $body = '');
```

Each of these methods requires a `$url` and some optional parameters to send an
Expand Down Expand Up @@ -1921,7 +1921,7 @@ See also [GET request client example](examples/01-client-get-request.php).

#### post()

The `post(string $url, array $headers = array(), string|ReadableStreamInterface $contents = ''): PromiseInterface<ResponseInterface>` method can be used to
The `post(string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface>` method can be used to
send an HTTP POST request.

```php
Expand Down Expand Up @@ -1983,7 +1983,7 @@ $browser->head($url)->then(function (Psr\Http\Message\ResponseInterface $respons

#### patch()

The `patch(string $url, array $headers = array(), string|ReadableStreamInterface $contents = ''): PromiseInterface<ResponseInterface>` method can be used to
The `patch(string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface>` method can be used to
send an HTTP PATCH request.

```php
Expand Down Expand Up @@ -2015,7 +2015,7 @@ $browser->patch($url, array('Content-Length' => '11'), $body);

#### put()

The `put(string $url, array $headers = array()): PromiseInterface<ResponseInterface>` method can be used to
The `put(string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface>` method can be used to
send an HTTP PUT request.

```php
Expand Down Expand Up @@ -2049,7 +2049,7 @@ $browser->put($url, array('Content-Length' => '11'), $body);

#### delete()

The `delete(string $url, array $headers = array()): PromiseInterface<ResponseInterface>` method can be used to
The `delete(string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface>` method can be used to
send an HTTP DELETE request.

```php
Expand Down
24 changes: 12 additions & 12 deletions src/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ public function get($url, array $headers = array())
*
* @param string $url URL for the request.
* @param array $headers
* @param string|ReadableStreamInterface $contents
* @param string|ReadableStreamInterface $body
* @return PromiseInterface<ResponseInterface>
*/
public function post($url, array $headers = array(), $contents = '')
public function post($url, array $headers = array(), $body = '')
{
return $this->requestMayBeStreaming('POST', $url, $headers, $contents);
return $this->requestMayBeStreaming('POST', $url, $headers, $body);
}

/**
Expand Down Expand Up @@ -220,12 +220,12 @@ public function head($url, array $headers = array())
*
* @param string $url URL for the request.
* @param array $headers
* @param string|ReadableStreamInterface $contents
* @param string|ReadableStreamInterface $body
* @return PromiseInterface<ResponseInterface>
*/
public function patch($url, array $headers = array(), $contents = '')
public function patch($url, array $headers = array(), $body = '')
{
return $this->requestMayBeStreaming('PATCH', $url , $headers, $contents);
return $this->requestMayBeStreaming('PATCH', $url , $headers, $body);
}

/**
Expand Down Expand Up @@ -262,12 +262,12 @@ public function patch($url, array $headers = array(), $contents = '')
*
* @param string $url URL for the request.
* @param array $headers
* @param string|ReadableStreamInterface $contents
* @param string|ReadableStreamInterface $body
* @return PromiseInterface<ResponseInterface>
*/
public function put($url, array $headers = array(), $contents = '')
public function put($url, array $headers = array(), $body = '')
{
return $this->requestMayBeStreaming('PUT', $url, $headers, $contents);
return $this->requestMayBeStreaming('PUT', $url, $headers, $body);
}

/**
Expand All @@ -281,12 +281,12 @@ public function put($url, array $headers = array(), $contents = '')
*
* @param string $url URL for the request.
* @param array $headers
* @param string|ReadableStreamInterface $contents
* @param string|ReadableStreamInterface $body
* @return PromiseInterface<ResponseInterface>
*/
public function delete($url, array $headers = array(), $contents = '')
public function delete($url, array $headers = array(), $body = '')
{
return $this->requestMayBeStreaming('DELETE', $url, $headers, $contents);
return $this->requestMayBeStreaming('DELETE', $url, $headers, $body);
}

/**
Expand Down

0 comments on commit b011736

Please sign in to comment.