@@ -89,6 +89,14 @@ class HttpResponse
89
89
public function __construct ($ responseString , $ originUrl = null , $ originMethod = null , $ wasAsync = false )
90
90
{
91
91
$ this ->_wasAsync = $ wasAsync ;
92
+ if ($ originUrl !== null && $ originMethod !== null ) {
93
+ if ($ responseString === '' ) {
94
+ throw new ClientException (
95
+ 'Got no response from the server after request to '
96
+ . $ originMethod . ' ' . $ originUrl . ' - Note: this may be a timeout issue '
97
+ );
98
+ }
99
+ }
92
100
93
101
list ($ this ->_header , $ this ->_body ) = HttpHelper::parseHttpMessage ($ responseString , $ originUrl , $ originMethod );
94
102
list ($ this ->_httpCode , $ this ->_result , $ this ->_headers ) = HttpHelper::parseHeaders ($ this ->_header );
@@ -98,18 +106,11 @@ public function __construct($responseString, $originUrl = null, $originMethod =
98
106
) {
99
107
// got no response body!
100
108
if ($ originUrl !== null && $ originMethod !== null ) {
101
- if ($ responseString === '' ) {
102
- throw new ClientException (
103
- 'Got no response from the server after request to '
104
- . $ originMethod . ' ' . $ originUrl . ' - Note: this may be a timeout issue '
105
- );
106
- }
107
109
throw new ClientException (
108
110
'Got an invalid response from the server after request to '
109
111
. $ originMethod . ' ' . $ originUrl
110
112
);
111
113
}
112
-
113
114
throw new ClientException ('Got an invalid response from the server ' );
114
115
}
115
116
}
0 commit comments