echo-content.py (505B)
1 from wptserve.utils import isomorphic_encode 2 3 def main(request, response): 4 5 headers = [(b"X-Request-Method", isomorphic_encode(request.method)), 6 (b"X-Request-Content-Length", request.headers.get(b"Content-Length", b"NO")), 7 (b"X-Request-Content-Type", request.headers.get(b"Content-Type", b"NO")), 8 # Avoid any kind of content sniffing on the response. 9 (b"Content-Type", b"text/plain")] 10 content = request.body 11 12 return headers, content