@@ -12,7 +12,7 @@ final class TransportRedirectMock implements Transport {
12
12
13
13
private $ redirected = [];
14
14
15
- public $ redirected_transport = NULL ;
15
+ public $ redirected_transport = null ;
16
16
17
17
private static $ messages = [
18
18
100 => '100 Continue ' ,
@@ -64,26 +64,26 @@ final class TransportRedirectMock implements Transport {
64
64
];
65
65
66
66
public function request ($ url , $ headers = [], $ data = [], $ options = []) {
67
- if (array_key_exists ($ url , $ this ->redirected ))
68
- {
67
+ if (array_key_exists ($ url , $ this ->redirected )) {
69
68
return $ this ->redirected_transport ->request ($ url , $ headers , $ data , $ options );
70
69
}
71
70
72
- $ redirect_url = " https://example.com/redirected?url= " . urlencode ($ url );
71
+ $ redirect_url = ' https://example.com/redirected?url= ' . urlencode ($ url );
73
72
74
73
$ status = isset (self ::$ messages [$ this ->code ]) ? self ::$ messages [$ this ->code ] : $ this ->code . ' unknown ' ;
75
74
$ response = "HTTP/1.0 $ status \r\n" ;
76
75
$ response .= "Content-Type: text/plain \r\n" ;
77
76
if ($ this ->chunked ) {
78
77
$ response .= "Transfer-Encoding: chunked \r\n" ;
79
78
}
79
+
80
80
$ response .= "Location: $ redirect_url \r\n" ;
81
81
$ response .= $ this ->raw_headers ;
82
82
$ response .= "Connection: close \r\n\r\n" ;
83
83
$ response .= $ this ->body ;
84
84
85
- $ this ->redirected [$ url ] = TRUE ;
86
- $ this ->redirected [$ redirect_url ] = TRUE ;
85
+ $ this ->redirected [$ url ] = true ;
86
+ $ this ->redirected [$ redirect_url ] = true ;
87
87
88
88
return $ response ;
89
89
}
0 commit comments