@@ 109-127 (lines=19) @@ | ||
106 | * |
|
107 | * @return Response |
|
108 | */ |
|
109 | public function createNotAuthenticated( |
|
110 | Request $request, |
|
111 | string $accept, |
|
112 | string $authenticationType, |
|
113 | string $reason, |
|
114 | NormalizerContextInterface $context = null |
|
115 | ): Response { |
|
116 | return $this->createByError(new Error( |
|
117 | Error::SCOPE_HEADER, |
|
118 | 'not_authenticated', |
|
119 | 'missing or invalid authentication token', |
|
120 | 'authentication', |
|
121 | [ |
|
122 | 'type' => $authenticationType, |
|
123 | 'value' => $request->getHeaderLine('Authorization'), |
|
124 | 'reason' => $reason, |
|
125 | ] |
|
126 | ), $accept, 401, $context); |
|
127 | } |
|
128 | ||
129 | /** |
|
130 | * @param string $type |
|
@@ 197-213 (lines=17) @@ | ||
194 | * |
|
195 | * @return Response |
|
196 | */ |
|
197 | public function createContentTypeNotSupported( |
|
198 | Request $request, |
|
199 | string $accept, |
|
200 | array $supportedContentTypes, |
|
201 | NormalizerContextInterface $context = null |
|
202 | ): Response { |
|
203 | return $this->createByError(new Error( |
|
204 | Error::SCOPE_HEADER, |
|
205 | 'contentype_not_supported', |
|
206 | 'the given content type is not supported', |
|
207 | 'content-type', |
|
208 | [ |
|
209 | 'contentType' => $request->getHeaderLine('Content-Type'), |
|
210 | 'supportedContentTypes' => $supportedContentTypes, |
|
211 | ] |
|
212 | ), $accept, 415, $context); |
|
213 | } |
|
214 | } |
|
215 |