Sha256: a3deea819c4cbc3b3e1e0576ad38c1e906a585d62355fca1d921b7eb562a7431

Contents?: true

Size: 399 Bytes

Versions: 1

Compression:

Stored size: 399 Bytes

Contents

ApiValidator::Header.register(:post, {
  'Content-Type' => lambda { |response|
    post_type = response.env['expected_post_type'] ? response.env['expected_post_type'] : nil
    post_type ||= (Hash === response.body && response.body['type']) ? response.body['type'] : nil
    if post_type
      %r{\btype=['"]#{ Regexp.escape(post_type) }['"]}
    else
      %r{\btype=['"][^'"]+['"]}
    end
  }
})

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tent-validator-0.2.0 lib/tent-validator/validators/support/post_header_expectation.rb