Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From what I can tell, this is a limitation of the way that WSGI works. The stream needs only be consumable <em>once</em> (<a href="http://www.python.org/dev/peps/pep-0333/" rel="nofollow">PEP 333</a> and <a href="http://www.python.org/dev/peps/pep-3333/" rel="nofollow">3333</a> only require that the stream support <code>read*</code> calls, <code>tell</code> does not need to be supported). Once the stream is exhausted it cannot be re-streamed to other WSGI applications further "inward". Take a look at these two sections of Werkzeug's documentation for more information:</p> <ol> <li><a href="http://werkzeug.pocoo.org/docs/request_data/" rel="nofollow">http://werkzeug.pocoo.org/docs/request_data/</a></li> <li><a href="http://werkzeug.pocoo.org/docs/http/#module-werkzeug.formparser" rel="nofollow">http://werkzeug.pocoo.org/docs/http/#module-werkzeug.formparser</a></li> </ol> <p>The way to avoid this issue is to wrap the <strong>input stream</strong> (<code>wsgi.input</code>) in an object that implements the <code>read</code> and <code>readline</code> methods. Then, only when the final application in the chain actually attempts to exhaust the stream will your methods be run. See <a href="http://flask.pocoo.org/docs/patterns/requestchecksum/" rel="nofollow">Flask's documentation on generating a request checksum</a> for an example of this pattern.</p> <p>That being said, are you sure a middleware is the best solution to your problems? If you need to perform some action (dispatch, logging, authentication) based on the content of the <em>body</em> of the request you may be better off making it a part of your application, rather than a stand-alone application of its own.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload