Exemple #1
0
    def test_header_rewriter_fix(self):
        @Request.application
        def application(request):
            return Response("", headers=[('X-Foo', 'bar')])

        application = fixers.HeaderRewriterFix(application, ('X-Foo', ),
                                               (('X-Bar', '42'), ))
        response = Response.from_app(application, create_environ())
        assert response.headers['Content-Type'] == 'text/plain; charset=utf-8'
        assert 'X-Foo' not in response.headers
        assert response.headers['X-Bar'] == '42'
Exemple #2
0
    def test_header_rewriter_fix(self):
        @Request.application
        def application(request):
            return Response("", headers=[("X-Foo", "bar")])

        application = fixers.HeaderRewriterFix(application, ("X-Foo", ),
                                               (("X-Bar", "42"), ))
        response = Response.from_app(application, create_environ())
        assert response.headers["Content-Type"] == "text/plain; charset=utf-8"
        assert "X-Foo" not in response.headers
        assert response.headers["X-Bar"] == "42"