bin/cheat_response_proxy in libgss-0.8.3 vs bin/cheat_response_proxy in libgss-0.8.4

- old
+ new

@@ -7,12 +7,14 @@ handler = Proc.new do |req, res| puts "=" * 100 puts req.request_uri.to_s puts req.path puts res.body.to_s - if req.path == "/api/1.0.0/actions.json" - # server_timeの戻り値を10日先に書き換えている - res.body.gsub!(/\"result\":\s*(\d+)/){ "\"result\":%d" % ($1.to_i + 10 * 24 * 60 * 60) } + if req.path =~ %r{/api/\d+.\d+.\d+/actions.json} + # server_timeの戻り値を10日先に書き換えています + body = res.body + body.gsub!(/\\\"result\\\":\s*(\d+)/){ "\\\"result\\\":%d" % ($1.to_i + 10 * 24 * 60 * 60) } + body.gsub!(/\"result\":\s*(\d+)/){ "\"result\":%d" % ($1.to_i + 10 * 24 * 60 * 60) } end puts "-" * 100 end s = WEBrick::HTTPProxyServer.new(