lib/rspec_api_docs/formatter/resource/example.rb in rspec-api-docs-0.12.0 vs lib/rspec_api_docs/formatter/resource/example.rb in rspec-api-docs-0.13.0
- old
+ new
@@ -61,11 +61,11 @@
request_query_parameters: request.params,
request_content_type: request.content_type,
response_status: response.status,
response_status_text: response_status_text(response.status),
response_body: response_body(response.body),
- response_headers: response.headers,
+ response_headers: response_headers(response.headers),
response_content_type: response.content_type,
}
end
end
@@ -107,9 +107,17 @@
metadata.fetch(:requests, []).reject { |pair| pair.any?(&:nil?) }
end
def request_headers(env)
RequestHeaders.call(env)
+ end
+
+ def response_headers(headers)
+ excluded_headers = RspecApiDocs.configuration.exclude_response_headers
+
+ headers.reject do |k, v|
+ excluded_headers.include?(k)
+ end
end
def request_path(request)
URI(request.path).tap do |uri|
uri.query = request.query_string unless request.query_string.empty?