django-ninja
django-ninja copied to clipboard
applying renderers and parsers to TestClient
Hey, how can I apply my own renderer and parser to TestClient? The API itself works correctly, but the TestClient only accepts and returns json format. It should be added to this that when using a custom renderer (for example, xml), the generated swager still sends the content type equal to app/json in the headers
Hi @VityasZV I think it should work out of the box
to send non-json body you can just use body argument in parsers tests:
see https://github.com/vitalik/django-ninja/blob/master/tests/test_parser.py#L38
for renderers:
https://github.com/vitalik/django-ninja/blob/master/tests/test_renderer.py#L89-L94