def test_websocket(self): r = parse_request('ws:/path/') res = r.resolve(language.Settings()) assert res.method.string().lower() == "get" assert res.tok(http.Path).value.val == "/path/" assert res.tok(http.Method).value.val.lower() == "get" assert http.get_header("Upgrade", res.headers).value.val == "websocket" r = parse_request('ws:put:/path/') res = r.resolve(language.Settings()) assert r.method.string().lower() == "put" assert res.tok(http.Path).value.val == "/path/" assert res.tok(http.Method).value.val.lower() == "put" assert http.get_header("Upgrade", res.headers).value.val == "websocket"
def test_parse_header(self): r = language.parse_pathod('400:h"foo"="bar"').next() assert http.get_header("foo", r.headers)