Class: Java::OrgApacheHttpClientMethods::HttpRequestBase

Inherits:
Object
  • Object
show all
Defined in:
lib/manticore/java_extensions.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object

Get a single request header



11
12
13
14
# File 'lib/manticore/java_extensions.rb', line 11

def [](key)
  h = get_last_header(key)
  h && h.value || nil
end

#[]=(key, val) ⇒ Object

Set a single request header



17
18
19
# File 'lib/manticore/java_extensions.rb', line 17

def []=(key, val)
  set_header key, val
end

#headersObject

Provides an easy way to get the request headers from any request



6
7
8
# File 'lib/manticore/java_extensions.rb', line 6

def headers
  Hash[*get_all_headers.flat_map { |h| [h.name, h.value] }]
end