lib/yao/faraday_middlewares.rb in yao-0.1.1 vs lib/yao/faraday_middlewares.rb in yao-0.2.0.rc1

- old
+ new

@@ -1,6 +1,19 @@ require 'faraday' +class Faraday::Request::Accept + def initialize(app, accept=nil) + @app = app + @accept = accept || 'application/json' + end + + def call(env) + env[:request_headers]['Accept'] = @accept + @app.call(env) + end +end +Faraday::Request.register_middleware accept: -> { Faraday::Request::Accept } + class Faraday::Request::OSToken def initialize(app, token) @app = app @token = token end