Traceback (most recent call last):
File "C:\code\venv\lib\site-packages\starlite\response\base.py", line 287, in render
return encode_json(content, self._enc_hook)
File "C:\code\venv\lib\site-packages\starlite\utils\serialization.py", line 118, in encode_json
return _msgspec_json_encoder.encode(obj)
File "C:\code\venv\lib\site-packages\starlite\utils\serialization.py", line 83, in default_serializer
raise TypeError(f"Unsupported type: {type(value)!r}")
TypeError: Unsupported type: <class 'pathlib.WindowsPath'>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\code\venv\lib\site-packages\starlite\middleware\exceptions\middleware.py", line 47, in __call__
await self.app(scope, receive, send)
File "C:\code\venv\lib\site-packages\starlite\routes\http.py", line 75, in handle
response = await self._get_response_for_request(
File "C:\code\venv\lib\site-packages\starlite\routes\http.py", line 127, in _get_response_for_request
response = await self._call_handler_function(
File "C:\code\venv\lib\site-packages\starlite\routes\http.py", line 163, in _call_handler_function
else await route_handler.to_response(
File "C:\code\venv\lib\site-packages\starlite\handlers\http.py", line 660, in to_response
return await response_handler(app=app, data=data, plugins=plugins, request=request) # type: ignore
File "C:\code\venv\lib\site-packages\starlite\handlers\http.py", line 236, in handler
return await create_response(data=data)
File "C:\code\venv\lib\site-packages\starlite\handlers\http.py", line 206, in create_response
response = response_class(
File "C:\code\venv\lib\site-packages\starlite\response\base.py", line 120, in __init__
self.body = content if isinstance(content, bytes) else self.render(content)
File "C:\code\venv\lib\site-packages\starlite\response\base.py", line 289, in render
raise ImproperlyConfiguredException("Unable to serialize response content") from e
starlite.exceptions.http_exceptions.ImproperlyConfiguredException: 500: Unable to serialize response content
Describe the bug When returning a
pathlib.WindowsPath
from an RouteHandler the object can not be serialized.To Reproduce uvicorn==0.20.0 starlite==1.48.1 pydantic==1.10.0 msgspec==0.11.0
When hitting "http://localhost:5010/path" the Response is 500 "Unable to serialize response content"