Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wsgi_intercept can't handle functions that stream chunked encoding data infinitely #16

Open
GoogleCodeExporter opened this issue Dec 4, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Write a WSGI application that returns an iterator that streams infinitely.
2. Try to test the WSGI application.

What is the expected output?
It'd be great if it could give you an iterator.

What do you see instead?
It tries to buffer everything.

What version of the product are you using?
0.4

On what operating system?
Linux jjinux 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 02:41:37 UTC 2010 
x86_64 GNU/Linux

Please provide any additional information below.
A WSGI application can return an iterator.  It knows how to output things using 
a chunked encoding.  That's useful to stream a possibly infinite amount of 
data.  My application is like that.  Unfortunately, this is not currently 
supported by wsgi_intercept.

I ended up using WebOb to test my application:

        request = webob.Request.blank('/')
        response = request.get_response(server.Handler.handle)
        assert response.app_iter.next() == "\n"
        assert response.app_iter.next() == '{"test": "data"}\n'

Original issue reported on code.google.com by [email protected] on 26 Jan 2011 at 2:29

@GoogleCodeExporter
Copy link
Author

Would it be easy to attach a simple wsgi app that I could use to reproduce 
this?  Or perhaps link to the source code of one.

Original comment by kumar.mcmillan on 26 Jan 2011 at 3:21

@GoogleCodeExporter
Copy link
Author

Perhaps something like this:

def application(environ, start_response):
    start_response("200 OK", [('Content-type', 'text/plain')])

    def response():
        yield "hi\n"

    return iter(response())

Original comment by [email protected] on 31 Mar 2011 at 12:22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant