Class: Aws::Crt::Http::Headers

Inherits:
Object
  • Object
show all
Includes:
ManagedNative
Defined in:
lib/aws-crt/http/headers.rb

Overview

HTTP Headers

Instance Method Summary collapse

Methods included from ManagedNative

included, #manage_native, #native, #native_set?, #release

Constructor Details

#initialize(headers = {}) ⇒ Headers

Returns a new instance of Headers.



14
15
16
17
18
19
20
21
22
# File 'lib/aws-crt/http/headers.rb', line 14

def initialize(headers = {})
  blob = StringBlob.encode(headers.flatten)
  blob_ptr = FFI::MemoryPointer.new(:char, blob.length)
  blob_ptr.write_array_of_char(blob)

  manage_native do
    Aws::Crt::Native.http_headers_new_from_blob(blob_ptr, blob.length)
  end
end

Instance Method Details

#to_blob_stringsObject



24
25
26
27
28
# File 'lib/aws-crt/http/headers.rb', line 24

def to_blob_strings
  buf_out = Aws::Crt::Native::CrtBuf.new
  Aws::Crt::Native.http_headers_to_blob(native, buf_out)
  StringBlob.decode(buf_out.to_blob)
end