blob: f926ed43fc4477bcf7eb63a3d1e121b5ce5f118a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
def main(request, response):
headers = [(b"Content-Type", b"text/plain")]
command = request.GET.first(b"cmd").lower()
test_id = request.GET.first(b"id")
header = request.GET.first(b"header")
if command == b"put":
request.server.stash.put(test_id, request.headers.get(header, b""))
elif command == b"get":
stashed_header = request.server.stash.take(test_id)
if stashed_header is not None:
headers.append((b"x-request-" + header, stashed_header))
else:
response.set_error(400, u"Bad Command")
return u"ERROR: Bad Command!"
return headers, u""
|