Skip to content

Commit a952b54

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/master' into issue94-patch
# Conflicts: # lib/Client.php
2 parents 861bb42 + 08fe96a commit a952b54

File tree

5 files changed

+22
-17
lines changed

5 files changed

+22
-17
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
33

44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## [3.9.4] - 2018-03-22
7+
### Fixed
8+
- Fixes [#586](https://github.com/sendgrid/sendgrid-php/issues/586), PR [#96](https://github.com/sendgrid/php-http-client/pull/96): Fix constructor function signature regression.
9+
610
## [3.9.3] - 2018-03-11
711
### Fixed
812
- Fixes [#584](https://github.com/sendgrid/sendgrid-php/issues/584), PR [#93](https://github.com/sendgrid/php-http-client/pull/93): Don't overwrite headers set from upstream dependencies.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Add php-http-client to your `composer.json` file. If you are not using [Composer
3939
```json
4040
{
4141
"require": {
42-
"sendgrid/php-http-client": "~3.9.3"
42+
"sendgrid/php-http-client": "~3.9.4"
4343
}
4444
}
4545
```

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "sendgrid/php-http-client",
33
"description": "HTTP REST client, simplified for PHP",
44
"type": "library",
5-
"version": "3.9.3",
5+
"version": "3.9.4",
66
"homepage": "http://github.com/sendgrid/php-http-client",
77
"keywords": ["SendGrid", "HTTP", "REST", "API", "Fluent"],
88
"license": "MIT",

lib/Client.php

+14-13
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,23 @@ class Client
7777
private $methods = ['get', 'post', 'patch', 'put', 'delete'];
7878

7979
/**
80-
* Initialize the client
81-
*
82-
* @param string $host the base url (e.g. https://api.sendgrid.com)
83-
* @param array $headers global request headers
84-
* @param string $version api version (configurable)
85-
* @param array $path holds the segments of the url path
86-
*/
87-
public function __construct($host, array $headers = [], $version = '/v3', array $path = [])
80+
* Initialize the client
81+
*
82+
* @param string $host the base url (e.g. https://api.sendgrid.com)
83+
* @param array $headers global request headers
84+
* @param string $version api version (configurable) - this is specific to the SendGrid API
85+
* @param array $path holds the segments of the url path
86+
* @param array $curlOptions extra options to set during curl initialization
87+
* @param bool $retryOnLimit set default retry on limit flag
88+
*/
89+
public function __construct($host, $headers = null, $version = null, $path = null, $curlOptions = null, $retryOnLimit = false)
8890
{
8991
$this->host = $host;
90-
$this->headers = $headers;
92+
$this->headers = $headers ?: [];
9193
$this->version = $version;
92-
$this->path = $path;
93-
94-
$this->curlOptions = [];
95-
$this->retryOnLimit = false;
94+
$this->path = $path ?: [];
95+
$this->curlOptions = $curlOptions ?: [];
96+
$this->retryOnLimit = $retryOnLimit;
9697
$this->isConcurrentRequest = false;
9798
$this->savedRequests = [];
9899
}

test/unit/ClientTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function setUp()
2020
'Content-Type: application/json',
2121
'Authorization: Bearer SG.XXXX'
2222
];
23-
$this->client = new MockClient($this->host, $this->headers);
23+
$this->client = new MockClient($this->host, $this->headers, '/v3');
2424
}
2525

2626
public function testConstructor()
@@ -91,7 +91,7 @@ public function testGetVersion()
9191
$this->assertSame('/v3', $client->getVersion());
9292

9393
$client = new Client('https://localhost:4010');
94-
$this->assertSame('/v3', $client->getVersion());
94+
$this->assertSame(null, $client->getVersion());
9595
}
9696

9797
public function testGetPath()

0 commit comments

Comments
 (0)