Skip to content

Body of 412 responses not sent since ETag handling was added #1231

@lafrech

Description

@lafrech

On HTTP error, the response includes a message such as:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>413 Request Entity Too Large</title>
<h1>Request Entity Too Large</h1>
<p>The data value transmitted exceeds the capacity limit.</p>

Since Etag handling was added, 412 error response does not include this message anymore.

Below is the test script I used.

#!/usr/bin/env python3

from werkzeug.exceptions import default_exceptions
from flask import Flask, abort


for http_exc in default_exceptions:

    app = Flask('test')
    client = app.test_client()

    @app.route('/')
    def test():
        abort(http_exc)

    response = client.get('/')
    assert response.status_code == http_exc

    if not response.get_data(as_text=True):
        raise ValueError('Missing data for HTTP error {}'.format(http_exc))

Feeding it to git bisect pointed me to 092e59a.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions