<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Project><name>wsgiheaders</name>
<shortdesc>Adding and replacing response headers</shortdesc>
<description>Adding and replacing response headers
&gt;&gt;&gt; import re
&gt;&gt;&gt; p = re.compile(r'.*\.html')
&gt;&gt;&gt; @replaceheader([(p, [('Content-type', 'text/html')])])
... def app(environ, start_response):
...     start_response('200 OK',
...                    [('Content-type', 'text/plain')])
...     return ['Hello, world!']
&gt;&gt;&gt; import webtest
&gt;&gt;&gt; app = webtest.TestApp(app)
&gt;&gt;&gt; res = app.get('/a.txt')
&gt;&gt;&gt; res.content_type
'text/plain'
&gt;&gt;&gt; res = app.get('/a.html')
&gt;&gt;&gt; res.content_type
'text/html'
&gt;&gt;&gt; p = re.compile(r'.*')
&gt;&gt;&gt; @addheader([(p, [('X-XRDS', 'http://localhost/services.xrds')])])
... def app(environ, start_response):
...     start_response('200 OK',
...                    [('Content-type', 'text/plain')])
...     return ['Hello, world!']
&gt;&gt;&gt; app = webtest.TestApp(app)
&gt;&gt;&gt; res = app.get('/')
&gt;&gt;&gt; res.headers['X-XRDS']
'http://localhost/services.xrds'</description>
<homepage rdf:resource="http://www.bitbucket.org/aodag/wsgiheaders/" />
<maintainer><foaf:Person><foaf:name>Atsushi Odagiri</foaf:name>
<foaf:mbox_sha1sum>672f68b789a8a7409503061a516d16fb67b22656</foaf:mbox_sha1sum></foaf:Person></maintainer>
<release><Version><revision>0.0</revision></Version></release>
</Project></rdf:RDF>