Skip to content

Commit 8361da1

Browse files
committed
Bugfix: make header location check case insensitive
1 parent a133a0a commit 8361da1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Api/ProductMediaFileApi.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,14 @@ protected function extractCodeFromCreationResponse(ResponseInterface $response)
132132
{
133133
$headers = $response->getHeaders();
134134

135-
if (!isset($headers['Location'][0])) {
135+
$location = isset($headers['Location'][0]) ? $headers['Location'][0] : $headers['location'][0] ?? null;
136+
137+
if (is_null($location)) {
136138
throw new RuntimeException('The response does not contain the URI of the created media-file.');
137139
}
138140

139141
$matches = [];
140-
if (1 !== preg_match(static::MEDIA_FILE_URI_CODE_REGEX, $headers['Location'][0], $matches)) {
142+
if (1 !== preg_match(static::MEDIA_FILE_URI_CODE_REGEX, $location, $matches)) {
141143
throw new RuntimeException('Unable to find the code in the URI of the created media-file.');
142144
}
143145

0 commit comments

Comments
 (0)