Skip to content

Commit 030ee31

Browse files
committed
Redirect URL is always blank due to wrong case - #64
1 parent 3a9e11e commit 030ee31

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

src/JonnyW/PhantomJs/Http/Response.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Response
6464
* @var string
6565
* @access public
6666
*/
67-
public $redirectUrl;
67+
public $redirectURL;
6868

6969
/**
7070
* Request time string
@@ -209,7 +209,7 @@ public function getUrl()
209209
*/
210210
public function getRedirectUrl()
211211
{
212-
return $this->redirectUrl;
212+
return $this->redirectURL;
213213
}
214214

215215
/**

src/JonnyW/PhantomJs/Tests/Integration/ClientTest.php

+22
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,28 @@ public function testResponseContainsHeaders()
243243

244244
$this->assertNotEmpty($response->getHeaders());
245245
}
246+
247+
/**
248+
* Test redirect URL is set in response
249+
* if request is redirected.
250+
*
251+
* @access public
252+
* @return void
253+
*/
254+
public function testRedirectUrlIsSetInResponseIfRequestIsRedirected()
255+
{
256+
$client = $this->getClient();
257+
258+
$request = $client->getMessageFactory()->createRequest();
259+
$response = $client->getMessageFactory()->createResponse();
260+
261+
$request->setMethod('GET');
262+
$request->setUrl('https://jigsaw.w3.org/HTTP/300/302.html');
263+
264+
$client->send($request, $response);
265+
266+
$this->assertNotEmpty($response->getRedirectUrl());
267+
}
246268

247269
/**
248270
* Test POST request sends request data.

src/JonnyW/PhantomJs/Tests/Unit/Http/ResponseTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testUrlCanBeImported()
103103
public function testRedirectUrlCanBeImported()
104104
{
105105
$data = array(
106-
'redirectUrl' => 'http://test.com'
106+
'redirectURL' => 'http://test.com'
107107
);
108108

109109
$response = $this->getResponse();

0 commit comments

Comments
 (0)