Skip to content

Commit f9bb264

Browse files
author
Bryant Luk
committed
MAGETWO-32767: Fix Default Accept Header
- Ensure that method by default returns a string[] for Accept values
1 parent 080274f commit f9bb264

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/code/Magento/Webapi/Controller/Rest/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function getAcceptTypes()
103103
foreach ($qualityToTypes as $typeList) {
104104
$orderedTypes += $typeList;
105105
}
106-
return empty($orderedTypes) ? self::DEFAULT_ACCEPT : array_keys($orderedTypes);
106+
return empty($orderedTypes) ? [self::DEFAULT_ACCEPT] : array_keys($orderedTypes);
107107
}
108108

109109
/**

dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/RequestTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function providerAcceptType()
177177
{
178178
return [
179179
// Each element is: array(Accept HTTP header value, expected result))
180-
['', []],
180+
['', ['*/*']],
181181
[
182182
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
183183
['text/html', 'application/xhtml+xml', 'application/xml', '*/*']

0 commit comments

Comments
 (0)