| @@ 125-137 (lines=13) @@ | ||
| 122 | * |
|
| 123 | * @return Response |
|
| 124 | */ |
|
| 125 | public function createContentTypeNotSupportedResponse(Request $request, string $accept): Response |
|
| 126 | { |
|
| 127 | return $this->createResponseByError($request, 415, $accept, new Error( |
|
| 128 | Error::SCOPE_HEADER, |
|
| 129 | 'contentype_not_supported', |
|
| 130 | 'the given content type is not supported', |
|
| 131 | 'content-type', |
|
| 132 | [ |
|
| 133 | 'contentType' => $request->getHeaderLine('Content-Type'), |
|
| 134 | 'supportedContentTypes' => $this->requestManager->getSupportedContentTypes(), |
|
| 135 | ] |
|
| 136 | )); |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * @param Request $request |
|
| @@ 146-158 (lines=13) @@ | ||
| 143 | * |
|
| 144 | * @return Response |
|
| 145 | */ |
|
| 146 | public function createBodyNotDeserializableResponse(Request $request, string $accept, string $contentType): Response |
|
| 147 | { |
|
| 148 | return $this->createResponseByError($request, 400, $accept, new Error( |
|
| 149 | Error::SCOPE_BODY, |
|
| 150 | 'body_not_deserializable', |
|
| 151 | 'the given body is not deserializable with given content-type', |
|
| 152 | 'deserialize', |
|
| 153 | [ |
|
| 154 | 'contentType' => $contentType, |
|
| 155 | 'body' => (string) $request->getBody(), |
|
| 156 | ] |
|
| 157 | )); |
|
| 158 | } |
|
| 159 | ||
| 160 | /** |
|
| 161 | * @param Request $request |
|