Sha256: a61e6ade01708086bdeba2aad536a3f54be30d0ce824e4a2cbdb959f52fb56a3

Contents?: true

Size: 801 Bytes

Versions: 2

Compression:

Stored size: 801 Bytes

Contents

module Example
  class HelloMiddleware < Faraday::Middleware
    def call(request_env)
      request_env.request_headers['Greetings'] ||= ""
      request_env.request_headers['Greetings'] << 'Hello'
      @app.call(request_env).on_complete do |response_env|
        response_env.response_headers['Greetings'] ||= ""
        response_env.response_headers['Greetings'] << 'Hello'
      end
    end
  end

  class GoodbyeMiddleware < Faraday::Middleware
    def call(request_env)
      request_env.request_headers['Greetings'] ||= ""
      request_env.request_headers['Greetings'] << 'Goodbye'
      @app.call(request_env).on_complete do |response_env|
        response_env.response_headers['Greetings'] ||= ""
        response_env.response_headers['Greetings'] << 'Goodbye'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plaza-0.1.1 spec/plaza/support/middleware.rb
plaza-0.1.0 spec/plaza/support/middleware.rb