サーバ側はSinatraのview (erb)で書いたらこんな感じ。
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>post /</title>
</head>
<body>
<div>post /</div>
<div>Content-Type: <%= request.content_type%></div>
<div>Content-Encoding: <%= request.env["HTTP_CONTENT_ENCODING"]%></div>
<textarea cols="80" rows="20" readonly><%=
if "gzip" == request.env["HTTP_CONTENT_ENCODING"]
begin
Zlib::Inflate.inflate(request.body.read)
rescue => e
e.pretty_inspect
end
else
request.body.read
end
%></textarea>
</body>
</html>

0 件のコメント:
コメントを投稿