Skip to content

Commit

Permalink
Setting a default user agent.
Browse files Browse the repository at this point in the history
  • Loading branch information
evert committed Jan 5, 2016
1 parent 9374552 commit dd87ff5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ChangeLog
------------------

* This package now supports sabre/event 3.0.
* The client now sets a default `User-Agent` header identifying this library.


4.1.0 (2015-09-04)
Expand Down
1 change: 1 addition & 0 deletions lib/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function __construct() {
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_NOBODY => false,
CURLOPT_USERAGENT => 'sabre-http/' . Version::VERSION . ' (http://sabre.io/)',
];

}
Expand Down
5 changes: 5 additions & 0 deletions tests/HTTP/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function testCreateCurlSettingsArrayGET() {
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => '',
CURLOPT_PUT => false,
CURLOPT_USERAGENT => 'sabre-http/' . Version::VERSION . ' (http://sabre.io/)',
];

// FIXME: CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS are currently unsupported by HHVM
Expand Down Expand Up @@ -50,6 +51,7 @@ function testCreateCurlSettingsArrayHEAD() {
CURLOPT_URL => 'http://example.org/',
CURLOPT_POSTFIELDS => '',
CURLOPT_PUT => false,
CURLOPT_USERAGENT => 'sabre-http/' . Version::VERSION . ' (http://sabre.io/)',
];

// FIXME: CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS are currently unsupported by HHVM
Expand Down Expand Up @@ -85,6 +87,7 @@ function testCreateCurlSettingsArrayGETAfterHEAD() {
CURLOPT_URL => 'http://example.org/',
CURLOPT_POSTFIELDS => '',
CURLOPT_PUT => false,
CURLOPT_USERAGENT => 'sabre-http/' . Version::VERSION . ' (http://sabre.io/)',
];

// FIXME: CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS are currently unsupported by HHVM
Expand Down Expand Up @@ -115,6 +118,7 @@ function testCreateCurlSettingsArrayPUTStream() {
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => ['X-Foo: bar'],
CURLOPT_URL => 'http://example.org/',
CURLOPT_USERAGENT => 'sabre-http/' . Version::VERSION . ' (http://sabre.io/)',
];

// FIXME: CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS are currently unsupported by HHVM
Expand All @@ -141,6 +145,7 @@ function testCreateCurlSettingsArrayPUTString() {
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => ['X-Foo: bar'],
CURLOPT_URL => 'http://example.org/',
CURLOPT_USERAGENT => 'sabre-http/' . Version::VERSION . ' (http://sabre.io/)',
];

// FIXME: CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS are currently unsupported by HHVM
Expand Down

0 comments on commit dd87ff5

Please sign in to comment.