Django rest framework vercel

i have deployed a django rest framework rest api on vercel, the issue is when i query from my frontend it returns html but when i type the endpoind directly in address bar it returns json as expected.

Hi and welcome to the community, @nqabandiweni!

It sounds like issue likely stems from your frontend not sending the correct Accept header.

When you access the endpoint directly, the browser sets this header to application/json, but your frontend might not. Take a look at your frontend requests and make sure to include the Accept: application/json header.

It’s also worth checking your Django REST Framework settings to default to JSON responses.

Thanks for the help, turns out the issue was with vercel authentication that is on by default

1 Like

Thanks for coming back with your solution!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.