Skip to main content

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

wsgiheaders-0.0.zip (5.1 kB view details)

Uploaded Source

Built Distributions

wsgiheaders-0.0.win32.exe (70.8 kB view details)

Uploaded Source

wsgiheaders-0.0-py2.6.egg (4.5 kB view details)

Uploaded Source

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

Hashes for wsgiheaders-0.0.zip
Algorithm Hash digest
SHA256 680e50e1a93bd3fc820e645bbccf1491b8d3cc9d5d8995e638355c9a4313dd0f
MD5 e31b730fe2f3610679c1aa633c5fd16b
BLAKE2b-256 122104936c88473cfcc81bc1913161e66f8617aaddf206ab008fdbcde784a2b1

See more details on using hashes here.

File details

Details for the file wsgiheaders-0.0.win32.exe.

File metadata

File hashes

Hashes for wsgiheaders-0.0.win32.exe
Algorithm Hash digest
SHA256 ca6b2d697e76679b2485192725134eaab153e2fde50e99a9aa842d3def933b82
MD5 5ebd72f109717c9cd33765d60b584bab
BLAKE2b-256 5753cdc8c7fde5710b1060bf3f5726a723788057597d11c3a892d2a6c7851628

See more details on using hashes here.

File details

Details for the file wsgiheaders-0.0-py2.6.egg.

File metadata

File hashes

Hashes for wsgiheaders-0.0-py2.6.egg
Algorithm Hash digest
SHA256 e18135aead8b03d34a6b83b46f9930551e9c8634fbe9e099d922337de13690bb
MD5 9832282fb0c38a96ae65d49509b69dcb
BLAKE2b-256 2b8c7e2f8539faa8a5f7dd0c676a441b5f39d9a1ae1fcfebdde4b0dfc4c97499

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page