Module: Aws::Rest::Response::HeaderListParser Private

Defined in:
lib/aws-sdk-core/rest/response/header_list_parser.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.parse_string_list(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

parse a list of possibly quoted and escaped string values Follows: # [RFC-7230’s specification of header values](datatracker.ietf.org/doc/html/rfc7230#section-3.2.6).



15
16
17
18
19
20
21
22
# File 'lib/aws-sdk-core/rest/response/header_list_parser.rb', line 15

def parse_string_list(value)
  buffer = StringScanner.new(value)
  parsed = []

  parsed << read_value(buffer) until buffer.eos?

  parsed
end

.parse_timestamp_list(value, ref) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/aws-sdk-core/rest/response/header_list_parser.rb', line 24

def parse_timestamp_list(value, ref)
  # timestamp lists use an http-date by default and are unescaped
  # eg: Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT
  case ref['timestampFormat'] || ref.shape['timestampFormat']
  when 'unixTimestamp'
    value.split(', ').map { |v| Time.at(v.to_f) }
  when 'iso8601' then value.split(', ').map { |v| Time.parse(v) }
  else
    # header default to rfc822/http-date, which has a comma after day
    value.split(',').each_slice(2).map { |v| Time.parse(v[0] + v[1])}
  end
end