Sha256: 4d9a0cf147751eec5a6652682f1260b702e4b96c57ad9b8c886935afca29ace6
Contents?: true
Size: 477 Bytes
Versions: 46
Compression:
Stored size: 477 Bytes
Contents
class Gillbus class FaradayResponseFileLogger < Faraday::Middleware def initialize(app, dir = '.') @dir = dir super(app) end def call(env) path = env.url.path @app.call(env).on_complete do |_environment| sanitized_path = path.gsub(/[^A-Za-z0-9_-]+/, '_').gsub(/^_|_$/, '') sanitized_path = '_' if sanitized_path == '' File.write(@dir + '/' + sanitized_path, env.body) if env.body != '' end end end end
Version data entries
46 entries across 46 versions & 1 rubygems