@@ -12,7 +12,7 @@ final class TransportRedirectMock implements Transport {
1212
1313 private $ redirected = [];
1414
15- public $ redirected_transport = NULL ;
15+ public $ redirected_transport = null ;
1616
1717 private static $ messages = [
1818 100 => '100 Continue ' ,
@@ -64,26 +64,26 @@ final class TransportRedirectMock implements Transport {
6464 ];
6565
6666 public function request ($ url , $ headers = [], $ data = [], $ options = []) {
67- if (array_key_exists ($ url , $ this ->redirected ))
68- {
67+ if (array_key_exists ($ url , $ this ->redirected )) {
6968 return $ this ->redirected_transport ->request ($ url , $ headers , $ data , $ options );
7069 }
7170
72- $ redirect_url = " https://example.com/redirected?url= " . urlencode ($ url );
71+ $ redirect_url = ' https://example.com/redirected?url= ' . urlencode ($ url );
7372
7473 $ status = isset (self ::$ messages [$ this ->code ]) ? self ::$ messages [$ this ->code ] : $ this ->code . ' unknown ' ;
7574 $ response = "HTTP/1.0 $ status \r\n" ;
7675 $ response .= "Content-Type: text/plain \r\n" ;
7776 if ($ this ->chunked ) {
7877 $ response .= "Transfer-Encoding: chunked \r\n" ;
7978 }
79+
8080 $ response .= "Location: $ redirect_url \r\n" ;
8181 $ response .= $ this ->raw_headers ;
8282 $ response .= "Connection: close \r\n\r\n" ;
8383 $ response .= $ this ->body ;
8484
85- $ this ->redirected [$ url ] = TRUE ;
86- $ this ->redirected [$ redirect_url ] = TRUE ;
85+ $ this ->redirected [$ url ] = true ;
86+ $ this ->redirected [$ redirect_url ] = true ;
8787
8888 return $ response ;
8989 }
0 commit comments