Sha256: 14b07ba7ed6361720e3120c37475df39c25b7b785ea933e7d8f5534aa422c7f0
Contents?: true
Size: 478 Bytes
Versions: 31
Compression:
Stored size: 478 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
31 entries across 31 versions & 1 rubygems