@@ 118-136 (lines=19) @@ | ||
115 | * |
|
116 | * @return Response |
|
117 | */ |
|
118 | public function createNotAuthenticated( |
|
119 | Request $request, |
|
120 | string $accept, |
|
121 | string $authenticationType, |
|
122 | string $reason, |
|
123 | NormalizerContext $context = null |
|
124 | ): Response { |
|
125 | return $this->createByError(new Error( |
|
126 | Error::SCOPE_HEADER, |
|
127 | 'not_authenticated', |
|
128 | 'missing or invalid authentication token', |
|
129 | 'authentication', |
|
130 | [ |
|
131 | 'type' => $authenticationType, |
|
132 | 'value' => $request->getHeaderLine('Authorization'), |
|
133 | 'reason' => $reason, |
|
134 | ] |
|
135 | ), $accept, 401, $context); |
|
136 | } |
|
137 | ||
138 | /** |
|
139 | * @param string $type |
|
@@ 206-222 (lines=17) @@ | ||
203 | * |
|
204 | * @return Response |
|
205 | */ |
|
206 | public function createContentTypeNotSupported( |
|
207 | Request $request, |
|
208 | string $accept, |
|
209 | array $supportedContentTypes, |
|
210 | NormalizerContext $context = null |
|
211 | ): Response { |
|
212 | return $this->createByError(new Error( |
|
213 | Error::SCOPE_HEADER, |
|
214 | 'contentype_not_supported', |
|
215 | 'the given content type is not supported', |
|
216 | 'content-type', |
|
217 | [ |
|
218 | 'contentType' => $request->getHeaderLine('Content-Type'), |
|
219 | 'supportedContentTypes' => $this->deserializer->getContentTypes(), |
|
220 | ] |
|
221 | ), $accept, 415, $context); |
|
222 | } |
|
223 | } |
|
224 |