Adding and replacing response headers
Project description
Adding and replacing response headers
>>> @replaceheader([(r'.*\.html', [('Content-type', 'text/html')])]) ... def app(environ, start_response): ... start_response('200 OK', ... [('Content-type', 'text/plain')]) ... return ['Hello, world!'] >>> import webtest >>> app = webtest.TestApp(app) >>> res = app.get('/a.txt') >>> res.content_type 'text/plain' >>> res = app.get('/a.html') >>> res.content_type 'text/html' >>> @addheader([('.*', [('X-XRDS', 'http://localhost/services.xrds')])]) ... def app(environ, start_response): ... start_response('200 OK', ... [('Content-type', 'text/plain')]) ... return ['Hello, world!'] >>> app = webtest.TestApp(app) >>> res = app.get('/') >>> res.headers['X-XRDS'] 'http://localhost/services.xrds'
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wsgiheaders-0.0.1.zip
(5.1 kB
view details)
Built Distributions
wsgiheaders-0.0.1.win32.exe
(70.8 kB
view details)
wsgiheaders-0.0.1-py2.6.egg
(4.7 kB
view details)
File details
Details for the file wsgiheaders-0.0.1.zip
.
File metadata
- Download URL: wsgiheaders-0.0.1.zip
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55bab19d0412e4929e9c4062778fe09fbd36add7f81531ef3eeb5c9162c92c4c |
|
MD5 | 8e1db96f5f825cc606f1683a67bd007a |
|
BLAKE2b-256 | 5895f4526de13d12411e09feb9b2ce183855691b12dece2a9f134cb7398b0bcf |
File details
Details for the file wsgiheaders-0.0.1.win32.exe
.
File metadata
- Download URL: wsgiheaders-0.0.1.win32.exe
- Upload date:
- Size: 70.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bba78a6e8d1570c07e2c85cdef5b2f5df2e15a3d1587833f8e3b328ef5cef78 |
|
MD5 | de02b78038e5a1b7573481f12cc43218 |
|
BLAKE2b-256 | 003c447aefccee12d8d2bf9c2db0ac5121b5d9c4f058f600b7645091b96908b4 |
File details
Details for the file wsgiheaders-0.0.1-py2.6.egg
.
File metadata
- Download URL: wsgiheaders-0.0.1-py2.6.egg
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2af3879030c8bcd1eed5ae72b0b31beacd825a96f282594606316c4194a0b537 |
|
MD5 | a79379d69ee384da036576d69cd5b1f0 |
|
BLAKE2b-256 | 33488012edfe7476031ce499e2a9952a9b471ca3383abe1998319f39e1dd6938 |