diff --git a/lizmap/modules/lizmap/lib/Request/Proxy.php b/lizmap/modules/lizmap/lib/Request/Proxy.php index 7368033b5b..d1da1f7984 100644 --- a/lizmap/modules/lizmap/lib/Request/Proxy.php +++ b/lizmap/modules/lizmap/lib/Request/Proxy.php @@ -465,9 +465,14 @@ public static function getRemoteData($url, $options = null, $debug = null, $meth $options = self::buildOptions($options, $method, $debug); $response = self::sendRequest($url, $options); + $contentType = 'application/octet-stream'; + if ($response->hasHeader('Content-Type')) { + $contentType = $response->getHeader('Content-Type')[0]; + } + return array( (string) $response->getBody(), - $response->getHeader('Content-Type')[0], + $contentType, $response->getStatusCode(), $response->getHeaders(), ); @@ -490,9 +495,14 @@ public static function getRemoteDataAsStream($url, $options = null) $response = self::sendRequest($url, $options); + $contentType = 'application/octet-stream'; + if ($response->hasHeader('Content-Type')) { + $contentType = $response->getHeader('Content-Type')[0]; + } + return new ProxyResponse( $response->getStatusCode(), - $response->getHeader('Content-Type')[0], + $contentType, $response->getHeaders(), $response->getBody() );