Class: Playwright::HttpHeaders

Inherits:
Object
  • Object
show all
Defined in:
lib/playwright/http_headers.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(headers) ⇒ HttpHeaders

Returns a new instance of HttpHeaders.

Parameters:

  • headers (Hash)


4
5
6
# File 'lib/playwright/http_headers.rb', line 4

def initialize(headers)
  @headers = headers
end

Class Method Details

.parse_serialized(serialized_headers) ⇒ Object



14
15
16
17
18
# File 'lib/playwright/http_headers.rb', line 14

def self.parse_serialized(serialized_headers)
  new(serialized_headers.map do |header|
    [header['name'].downcase, header['value']]
  end.to_h)
end

Instance Method Details

#as_serializedObject



8
9
10
11
12
# File 'lib/playwright/http_headers.rb', line 8

def as_serialized
  @headers.map do |key, value|
    { name: key, value: value }
  end
end