Class: CodeClimate::Middleware

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/code_climate/middleware.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#call(request_env) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/code_climate/middleware.rb', line 4

def call(request_env)
  headers = {}
  headers['Content-Type'] = 'application/vnd.api+json'
  headers['Authorization'] = 'Token token=' + CodeClimate::Client.api_token
  request_env[:request_headers].merge!(headers)

  @app.call(request_env).on_complete do |response_env|
    # do something with the response
    # response_env[:response_headers].merge!(...)
  end
end