Class: Bidi2pdf::Bidi::AddHeadersInterceptor
- Inherits:
-
Object
- Object
- Bidi2pdf::Bidi::AddHeadersInterceptor
- Includes:
- Interceptor
- Defined in:
- lib/bidi2pdf/bidi/add_headers_interceptor.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#url_patterns ⇒ Object
readonly
Returns the value of attribute url_patterns.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(headers:, url_patterns:, context:) ⇒ AddHeadersInterceptor
constructor
A new instance of AddHeadersInterceptor.
- #process_interception(_event_response, _navigation_id, network_id, _url) ⇒ Object
Methods included from Interceptor
#client, #handle_event, included, #interceptor_id, #register_with_client, #unregister_with_client, #validate_phases!
Constructor Details
#initialize(headers:, url_patterns:, context:) ⇒ AddHeadersInterceptor
Returns a new instance of AddHeadersInterceptor.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bidi2pdf/bidi/add_headers_interceptor.rb', line 18 def initialize(headers:, url_patterns:, context:) @headers = headers.map do |header| { name: header[:name], value: { type: "string", value: header[:value] } } end @url_patterns = url_patterns @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
16 17 18 |
# File 'lib/bidi2pdf/bidi/add_headers_interceptor.rb', line 16 def context @context end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
16 17 18 |
# File 'lib/bidi2pdf/bidi/add_headers_interceptor.rb', line 16 def headers @headers end |
#url_patterns ⇒ Object (readonly)
Returns the value of attribute url_patterns.
16 17 18 |
# File 'lib/bidi2pdf/bidi/add_headers_interceptor.rb', line 16 def url_patterns @url_patterns end |
Class Method Details
.events ⇒ Object
13 |
# File 'lib/bidi2pdf/bidi/add_headers_interceptor.rb', line 13 def events = ["network.beforeRequestSent"] |
.phases ⇒ Object
11 |
# File 'lib/bidi2pdf/bidi/add_headers_interceptor.rb', line 11 def phases = [Bidi2pdf::Bidi::Commands::AddIntercept::BEFORE_REQUEST] |
Instance Method Details
#process_interception(_event_response, _navigation_id, network_id, _url) ⇒ Object
33 34 35 36 |
# File 'lib/bidi2pdf/bidi/add_headers_interceptor.rb', line 33 def process_interception(_event_response, , network_id, _url) cmd = Bidi2pdf::Bidi::Commands::NetworkContinue.new request: network_id, headers: headers client.send_cmd cmd end |