wsgiheaders 0.0
Adding and replacing response headers
Latest Version: 0.2
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'
| File | Type | Py Version | Uploaded on | Size | # downloads |
|---|---|---|---|---|---|
| wsgiheaders-0.0-py2.6.egg (md5) | Python Egg | 2.6 | 2009-01-05 15:39:04 | 4KB | 69 |
| wsgiheaders-0.0.win32.exe (md5) | MS Windows installer | any | 2009-01-05 15:39:06 | 69KB | 7 |
| wsgiheaders-0.0.zip (md5) | Source | 2009-01-05 15:39:09 | 4KB | 21 | |
- Author: Atsushi Odagiri <aodagx at gmail com>
- Home Page: http://www.bitbucket.org/aodag/wsgiheaders/
- License: MIT License
- Categories
- Package Index Owner: aodag
- DOAP record: wsgiheaders-0.0.xml
