コード例 #1
0
    def test_headers_setattr_and_getattr_double_word(self):
        headers = Headers()
        headers.Cache_Control = "no-cache"

        assert headers.Cache_Control == "no-cache"
        assert headers.Cache_Control == b"no-cache"

        assert headers["Cache-Control"] == "no-cache"
        assert headers["Cache-Control"] == b"no-cache"
        assert headers[b"Cache-Control"] == "no-cache"
        assert headers[b"Cache-Control"] == b"no-cache"

        assert headers.get("Cache-Control") == "no-cache"
        assert headers.get("Cache-Control") == b"no-cache"
        assert headers.get(b"Cache-Control") == "no-cache"
        assert headers.get(b"Cache-Control") == b"no-cache"
コード例 #2
0
    def test_headers_setattr_and_getattr_single_word(self):
        headers = Headers()
        headers.Host = "github.com"

        assert headers.Host == "github.com"
        assert headers.Host == b"github.com"

        assert headers["Host"] == "github.com"
        assert headers["Host"] == b"github.com"
        assert headers[b"Host"] == "github.com"
        assert headers[b"Host"] == b"github.com"

        assert headers.get("Host") == "github.com"
        assert headers.get("Host") == b"github.com"
        assert headers.get(b"Host") == "github.com"
        assert headers.get(b"Host") == b"github.com"