Adding and replacing response headers
Project description
Adding and replacing response headers >>> import re >>> p = re.compile(r’.*.html’) >>> @replaceheader([(p, [(‘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’ >>> p = re.compile(r’.*’) >>> @addheader([(p, [(‘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
Built Distributions
File details
Details for the file wsgiheaders-0.0.zip
.
File metadata
- Download URL: wsgiheaders-0.0.zip
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 680e50e1a93bd3fc820e645bbccf1491b8d3cc9d5d8995e638355c9a4313dd0f |
|
MD5 | e31b730fe2f3610679c1aa633c5fd16b |
|
BLAKE2b-256 | 122104936c88473cfcc81bc1913161e66f8617aaddf206ab008fdbcde784a2b1 |
File details
Details for the file wsgiheaders-0.0.win32.exe
.
File metadata
- Download URL: wsgiheaders-0.0.win32.exe
- Upload date:
- Size: 70.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca6b2d697e76679b2485192725134eaab153e2fde50e99a9aa842d3def933b82 |
|
MD5 | 5ebd72f109717c9cd33765d60b584bab |
|
BLAKE2b-256 | 5753cdc8c7fde5710b1060bf3f5726a723788057597d11c3a892d2a6c7851628 |
File details
Details for the file wsgiheaders-0.0-py2.6.egg
.
File metadata
- Download URL: wsgiheaders-0.0-py2.6.egg
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e18135aead8b03d34a6b83b46f9930551e9c8634fbe9e099d922337de13690bb |
|
MD5 | 9832282fb0c38a96ae65d49509b69dcb |
|
BLAKE2b-256 | 2b8c7e2f8539faa8a5f7dd0c676a441b5f39d9a1ae1fcfebdde4b0dfc4c97499 |