From 2d8e8a409a82d306355d07f07ea0b067fb9ef031 Mon Sep 17 00:00:00 2001 From: Timur Vafin Date: Tue, 9 Jan 2018 20:46:54 +0300 Subject: [PATCH] Recognize JSON API response as JSON Make sure we recognize `application/vnd.api+json` as JSON to pretty format it using `response_body_formatter` --- lib/rspec_api_documentation/configuration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec_api_documentation/configuration.rb b/lib/rspec_api_documentation/configuration.rb index edb46e69..c4721674 100644 --- a/lib/rspec_api_documentation/configuration.rb +++ b/lib/rspec_api_documentation/configuration.rb @@ -110,7 +110,7 @@ def self.add_setting(name, opts = {}) # See RspecApiDocumentation::DSL::Endpoint#do_request add_setting :response_body_formatter, default: Proc.new { |_, _| Proc.new do |content_type, response_body| - if content_type =~ /application\/json/ + if content_type =~ /application\/.*json/ JSON.pretty_generate(JSON.parse(response_body)) else response_body