status.py (436B)
1 from wptserve.utils import isomorphic_encode 2 3 def main(request, response): 4 code = int(request.GET.first(b"code", 200)) 5 text = request.GET.first(b"text", b"OMG") 6 content = request.GET.first(b"content", b"") 7 type = request.GET.first(b"type", b"") 8 status = (code, text) 9 headers = [(b"Content-Type", type), 10 (b"X-Request-Method", isomorphic_encode(request.method))] 11 return status, headers, content