Ejemplo n.º 1
0
    def test_websocket(self):
        r = parse_request('ws:/path/')
        res = r.resolve(language.Settings())
        assert res.method.string().lower() == b"get"
        assert res.tok(http.Path).value.val == b"/path/"
        assert res.tok(http.Method).value.val.lower() == b"get"
        assert http.get_header(b"Upgrade", res.headers).value.val == b"websocket"

        r = parse_request('ws:put:/path/')
        res = r.resolve(language.Settings())
        assert r.method.string().lower() == b"put"
        assert res.tok(http.Path).value.val == b"/path/"
        assert res.tok(http.Method).value.val.lower() == b"put"
        assert http.get_header(b"Upgrade", res.headers).value.val == b"websocket"
Ejemplo n.º 2
0
    def test_websocket(self):
        r = parse_request('ws:/path/')
        res = r.resolve(language.Settings())
        assert res.method.string().lower() == b"get"
        assert res.tok(http.Path).value.val == b"/path/"
        assert res.tok(http.Method).value.val.lower() == b"get"
        assert http.get_header(b"Upgrade", res.headers).value.val == b"websocket"

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