[Flask] abort(400, "my message") not returning 400

Daniel Watrous daniel.watrous at Trinet.com
Tue Dec 10 14:53:23 EST 2019


Hi,

I have the following line in my flask application
            abort(400, "failure, User %s not found" % participant)

When that line is executed, I get a 500 reponse, not 400. I do get the error message, but he response is embedded in HTML.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>Error: 400 Bad Request: failure, User notauser not found</p>

Based on the docs, I expected to get a 400 error and a non-HTML response with just he message. Is there some way to achieve this?

Thanks,
Daniel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20191210/8061f286/attachment.html>


More information about the Flask mailing list