Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation for missing $body argument for put() and delete() methods #424

Merged
merged 2 commits into from
Aug 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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