module RSpecApi::Expectations::Response::Headers
Creates an example group for expectations on the response headers of last API request and runs it to verify that it matches best practices:
-
if request has entity body, the Content-Type header should be JSON
-
if request has pages, the Link header should have a ‘rel=prev’ link
Public Instance Methods
expect_headers(response, expectations = {})
click to toggle source
# File lib/rspec-api/expectations/headers.rb, line 12 def expect_headers(response, expectations = {}) context 'responds with headers that' do extend ContentType extend PageLinks expect_content_type response, expectations expect_page_links response, expectations end if expectations.any? end