Skip to content

Commit c632197

Browse files
authored
Merge pull request #502 from clue-labs/bye-httpbin
Update tests to remove defunct httpbin.org
2 parents 24dd698 + 7a5b57c commit c632197

7 files changed

+9
-75
lines changed

examples/03-client-request-any.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
$promises = array(
1414
$client->head('http://www.github.com/clue/http-react'),
15-
$client->get('https://httpbin.org/'),
15+
$client->get('https://httpbingo.org/'),
1616
$client->get('https://google.com'),
1717
$client->get('http://www.lueck.tv/psocksd'),
18-
$client->get('http://www.httpbin.org/absolute-redirect/5')
18+
$client->get('http://httpbingo.org/absolute-redirect/5')
1919
);
2020

2121
React\Promise\any($promises)->then(function (ResponseInterface $response) use ($promises) {

examples/04-client-post-json.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
);
1717

1818
$client->post(
19-
'https://httpbin.org/post',
19+
'https://httpbingo.org/post',
2020
array(
2121
'Content-Type' => 'application/json'
2222
),

examples/05-client-put-xml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
$child->name = 'Christian Lück';
1414

1515
$client->put(
16-
'https://httpbin.org/put',
16+
'https://httpbingo.org/put',
1717
array(
1818
'Content-Type' => 'text/xml'
1919
),

examples/22-client-stream-upload-from-stdin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
$in = new ReadableResourceStream(STDIN);
1818

19-
$url = isset($argv[1]) ? $argv[1] : 'https://httpbin.org/post';
19+
$url = isset($argv[1]) ? $argv[1] : 'https://httpbingo.org/post';
2020
echo 'Sending STDIN as POST to ' . $url . '' . PHP_EOL;
2121

22-
$client->post($url, array(), $in)->then(function (ResponseInterface $response) {
22+
$client->post($url, array('Content-Type' => 'text/plain'), $in)->then(function (ResponseInterface $response) {
2323
echo 'Received' . PHP_EOL . Psr7\str($response);
2424
}, function (Exception $e) {
2525
echo 'Error: ' . $e->getMessage() . PHP_EOL;

examples/91-client-benchmark-download.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
// a) simple download benchmark against public HTTP endpoint:
4-
// $ php examples/91-client-benchmark-download.php http://httpbin.org/get
4+
// $ php examples/91-client-benchmark-download.php http://httpbingo.org/get
55

66
// b) local 10 GB download benchmark against localhost address to avoid network overhead
77
//

tests/Client/FunctionalIntegrationTest.php

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -152,72 +152,6 @@ public function testSuccessfulResponseEmitsEnd()
152152
\React\Async\await(\React\Promise\Timer\timeout($promise, self::TIMEOUT_REMOTE));
153153
}
154154

155-
/** @group internet */
156-
public function testPostDataReturnsData()
157-
{
158-
if (defined('HHVM_VERSION')) {
159-
$this->markTestSkipped('Not supported on HHVM');
160-
}
161-
162-
// max_nesting_level was set to 100 for PHP Versions < 5.4 which resulted in failing test for legacy PHP
163-
ini_set('xdebug.max_nesting_level', 256);
164-
165-
$client = new Client(new ClientConnectionManager(new Connector(), Loop::get()));
166-
167-
$data = str_repeat('.', 33000);
168-
$request = $client->request(new Request('POST', 'https://' . (mt_rand(0, 1) === 0 ? 'eu.' : '') . 'httpbin.org/post', array('Content-Length' => strlen($data)), '', '1.0'));
169-
170-
$deferred = new Deferred();
171-
$request->on('response', function (ResponseInterface $response, ReadableStreamInterface $body) use ($deferred) {
172-
$deferred->resolve(Stream\buffer($body));
173-
});
174-
175-
$request->on('error', 'printf');
176-
$request->on('error', $this->expectCallableNever());
177-
178-
$request->end($data);
179-
180-
$buffer = \React\Async\await(\React\Promise\Timer\timeout($deferred->promise(), self::TIMEOUT_REMOTE));
181-
182-
$this->assertNotEquals('', $buffer);
183-
184-
$parsed = json_decode($buffer, true);
185-
$this->assertTrue(is_array($parsed) && isset($parsed['data']));
186-
$this->assertEquals(strlen($data), strlen($parsed['data']));
187-
$this->assertEquals($data, $parsed['data']);
188-
}
189-
190-
/** @group internet */
191-
public function testPostJsonReturnsData()
192-
{
193-
if (defined('HHVM_VERSION')) {
194-
$this->markTestSkipped('Not supported on HHVM');
195-
}
196-
197-
$client = new Client(new ClientConnectionManager(new Connector(), Loop::get()));
198-
199-
$data = json_encode(array('numbers' => range(1, 50)));
200-
$request = $client->request(new Request('POST', 'https://httpbin.org/post', array('Content-Length' => strlen($data), 'Content-Type' => 'application/json'), '', '1.0'));
201-
202-
$deferred = new Deferred();
203-
$request->on('response', function (ResponseInterface $response, ReadableStreamInterface $body) use ($deferred) {
204-
$deferred->resolve(Stream\buffer($body));
205-
});
206-
207-
$request->on('error', 'printf');
208-
$request->on('error', $this->expectCallableNever());
209-
210-
$request->end($data);
211-
212-
$buffer = \React\Async\await(\React\Promise\Timer\timeout($deferred->promise(), self::TIMEOUT_REMOTE));
213-
214-
$this->assertNotEquals('', $buffer);
215-
216-
$parsed = json_decode($buffer, true);
217-
$this->assertTrue(is_array($parsed) && isset($parsed['json']));
218-
$this->assertEquals(json_decode($data, true), $parsed['json']);
219-
}
220-
221155
/** @group internet */
222156
public function testCancelPendingConnectionEmitsClose()
223157
{

tests/FunctionalBrowserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public function testRequestWithAuthenticationSucceeds()
230230

231231
/**
232232
* ```bash
233-
* $ curl -vL "http://httpbin.org/redirect-to?url=http://user:pass@httpbin.org/basic-auth/user/pass"
233+
* $ curl -vL "http://httpbingo.org/redirect-to?url=http://user:pass@httpbingo.org/basic-auth/user/pass"
234234
* ```
235235
*
236236
* @doesNotPerformAssertions
@@ -244,7 +244,7 @@ public function testRedirectToPageWithAuthenticationSendsAuthenticationFromLocat
244244

245245
/**
246246
* ```bash
247-
* $ curl -vL "http://unknown:invalid@httpbin.org/redirect-to?url=http://user:pass@httpbin.org/basic-auth/user/pass"
247+
* $ curl -vL "http://unknown:invalid@httpbingo.org/redirect-to?url=http://user:pass@httpbingo.org/basic-auth/user/pass"
248248
* ```
249249
*
250250
* @doesNotPerformAssertions

0 commit comments

Comments
 (0)