Skip to content

Commit aa71e75

Browse files
committed
Fix php-curl-class#47: Add http header redirect parsing test
1 parent c315c5f commit aa71e75

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,13 @@ public function testHeaderCaseSensitivity() {
381381
$this->assertEquals($response_headers['eTaG'], $etag);
382382
}
383383

384+
public function testHeaderRedirect() {
385+
$test = new Test();
386+
$test->curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
387+
$test->server('redirect', 'GET');
388+
$this->assertEquals($test->curl->response, 'OK');
389+
}
390+
384391
public function testRequestURL() {
385392
$test = new Test();
386393
$this->assertFalse(substr($test->server('request_uri', 'GET'), -1) === '?');

tests/PHPCurlClass/server.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@
139139
}
140140
exit;
141141
}
142+
else if ($test === 'redirect') {
143+
if (!isset($_GET['redirect'])) {
144+
header('Location: ?redirect');
145+
exit;
146+
}
147+
148+
echo 'OK';
149+
exit;
150+
}
142151

143152
header('Content-Type: text/plain');
144153

0 commit comments

Comments
 (0)