Forums

Django Rest Framework - Bad request in production?

Hi there, I am using Django Rest Framework 3.2 and it works to me locally but as soon as deployed to production I keep getting the HTTP/1.1 400 Bad Request - 24 {"image":["No file was submitted."]} 0

Very strange. Furthermore, as I used Fiddler to debug which did not work, I tried using curl, and that succeeded fine from my home machine to pythonanywhere.

What can be the issue?

What are you doing when you get the 400 bad request?

I am doing a HTTP POST from different clients. It seems that there is an error in the django-rest-framework currently, so I am investigating. Please stand by.

I get the same error, how did you solve?

I ended up finding a bug in the use of separators in the HTTP parts of the client code, has not spent more time on proving the error in specific version of Django Rest. Still its unclear to me why there was no error in my local deployment, and after deploying to pythonanywhere. Let me know if you come closer :)