72 \
Magento\Framework\Webapi\Rest\
Request\DeserializerFactory $deserializerFactory,
76 $this->_deserializerFactory = $deserializerFactory;
86 if (
null === $this->_deserializer) {
87 $this->_deserializer = $this->_deserializerFactory->get($this->
getContentType());
102 foreach (preg_split(
'/,\s*/', $this->
getHeader(
'Accept')) as $definition) {
103 $typeWithQ = explode(
';', $definition);
104 $mimeType = trim(array_shift($typeWithQ));
107 if (!preg_match(
'~^([0-9a-z*+\-]+)(?:/([0-9a-z*+\-\.]+))?$~i', $mimeType)) {
114 $qAndValue = explode(
'=', $typeWithQ[0]);
116 if (2 == count($qAndValue)) {
117 $quality = $qAndValue[1];
120 $qualityToTypes[$quality][$mimeType] =
true;
122 krsort($qualityToTypes);
124 foreach ($qualityToTypes as $typeList) {
125 $orderedTypes += $typeList;
137 if (
null == $this->_bodyParams) {
138 $this->_bodyParams = [];
155 $headerValue = $this->
getHeader(
'Content-Type');
158 throw new \Magento\Framework\Exception\InputException(
new Phrase(
'Content-Type header is empty.'));
160 if (!preg_match(
'~^([a-z\d/\-+.]+)(?:; *charset=(.+))?$~Ui', $headerValue, $matches)) {
161 throw new \Magento\Framework\Exception\InputException(
new Phrase(
'Content-Type header is invalid.'));
164 if (isset($matches[2]) && self::REQUEST_CHARSET != strtolower($matches[2])) {
165 throw new \Magento\Framework\Exception\InputException(
new Phrase(
'UTF-8 is the only supported charset.'));
180 throw new \Magento\Framework\Exception\InputException(
new Phrase(
'Request method is invalid.'));
182 return $this->getMethod();
192 $requestBodyParams = [];
196 if ($httpMethod == self::HTTP_METHOD_POST ||
197 $httpMethod == self::HTTP_METHOD_PUT
202 return array_merge($requestBodyParams,
$params);
226 $pathParamValue = end($urlPathParams);
228 if ($pathParamValue ===
'me') {
229 return $requestBodyParams;
231 $pathParamKey = key($urlPathParams);
233 if (count($requestBodyParams) == 1 && is_array(end($requestBodyParams))) {
234 $requestDataKey = key($requestBodyParams);
235 $this->
substituteParameters($requestBodyParams[$requestDataKey], $pathParamKey, $pathParamValue);
240 return $requestBodyParams;
overrideRequestBodyIdWithPathParam($urlPathParams)
getHeader($header, $default=false)
static camelCaseToSnakeCase($name)
substituteParameters(&$requestData, $key, $value)
__construct(\Magento\Framework\Stdlib\Cookie\CookieReaderInterface $cookieReader, \Magento\Framework\Stdlib\StringUtils $converter, \Magento\Framework\App\AreaList $areaList, \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\Webapi\Rest\Request\DeserializerFactory $deserializerFactory, $uri=null)
static snakeCaseToCamelCase($input)