Module: HalSpec::Matchers::HaveAValidHalContentType

Included in:
HalSpec::Matchers
Defined in:
lib/hal_spec/matchers/have_a_valid_hal_content_type.rb

Instance Method Summary collapse

Instance Method Details

#has_valid_content_type?(headers) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
# File 'lib/hal_spec/matchers/have_a_valid_hal_content_type.rb', line 4

def has_valid_content_type?(headers)
  return false if headers.nil?
  return false unless headers.include?("Content-Type")
  headers["Content-Type"].match /application\/(vnd\.)?hal\+json(;.*)*/
end