api: generalize error handling

Return a consistent error response which takes into account the chosen
content type. Also adds tests for V1 server glue.
This commit is contained in:
Sarah Hoffmann
2023-03-21 16:24:26 +01:00
parent 00e3a752c9
commit 1facfd019b
5 changed files with 451 additions and 41 deletions

View File

@@ -46,10 +46,10 @@ class ParamWrapper(api_impl.ASGIAdaptor):
return falcon.HTTPError(status, description=msg)
def create_response(self, status: int, output: str, content_type: str) -> None:
def create_response(self, status: int, output: str) -> None:
self.response.status = status
self.response.text = output
self.response.content_type = content_type
self.response.content_type = self.content_type
def config(self) -> Configuration: