Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I may have done something wrong, but I remember that when I would do 'return {"json": "yes"}', it would not set the content-type to json. When I discovered this, I had to go back through a bunch of code and convert it to either fastaspi.Response or JSONResponse.

Creating the Response instance proved to be a better approach, because it makes it much easier to set content type, status codes, cookies, headers, etc.

Again - I might have done something wrong, but if you have an instance just doing 'return {"key": "value"}', check it with curl or browser dev tools to see what the Content-Type is.



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: