xref: /unit/test/python/legacy_force/asgi.py (revision 1848:4bd548074e2c)
11697Smax.romanov@nginx.comdef application(scope, receive=None, send=None):
21697Smax.romanov@nginx.com    assert scope['type'] == 'http'
31697Smax.romanov@nginx.com
41697Smax.romanov@nginx.com    if receive == None and send == None:
51697Smax.romanov@nginx.com        return app_http
61697Smax.romanov@nginx.com
71697Smax.romanov@nginx.com    else:
81697Smax.romanov@nginx.com        return app_http(receive, send)
91697Smax.romanov@nginx.com
10*1848Szelenkov@nginx.com
111697Smax.romanov@nginx.comasync def app_http(receive, send):
12*1848Szelenkov@nginx.com    await send(
13*1848Szelenkov@nginx.com        {
14*1848Szelenkov@nginx.com            'type': 'http.response.start',
15*1848Szelenkov@nginx.com            'status': 200,
16*1848Szelenkov@nginx.com            'headers': [(b'content-length', b'0'),],
17*1848Szelenkov@nginx.com        }
18*1848Szelenkov@nginx.com    )
19