Class: PublishingPlatformApi::PublishingPlatformHeaderSniffer

Inherits:
Object
  • Object
show all
Defined in:
lib/publishing_platform_api/middleware/publishing_platform_header_sniffer.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, header_name) ⇒ PublishingPlatformHeaderSniffer

Returns a new instance of PublishingPlatformHeaderSniffer.



5
6
7
8
# File 'lib/publishing_platform_api/middleware/publishing_platform_header_sniffer.rb', line 5

def initialize(app, header_name)
  @app = app
  @header_name = header_name
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
# File 'lib/publishing_platform_api/middleware/publishing_platform_header_sniffer.rb', line 10

def call(env)
  PublishingPlatformApi::PublishingPlatformHeaders.set_header(readable_name, env[@header_name])
  @app.call(env)
end