From 0551b958638567bcee12944e7ab20d11e8aade50 Mon Sep 17 00:00:00 2001 From: prosac Date: Fri, 16 Jun 2017 14:13:22 +0200 Subject: [PATCH 1/2] only tries to use gsub on header value if it is not Numeric --- lib/rspec_api_documentation/curl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec_api_documentation/curl.rb b/lib/rspec_api_documentation/curl.rb index 817c4f19..af12e2d5 100644 --- a/lib/rspec_api_documentation/curl.rb +++ b/lib/rspec_api_documentation/curl.rb @@ -69,7 +69,7 @@ def format_header(header) end def format_full_header(header, value) - formatted_value = value ? value.gsub(/"/, "\\\"") : '' + formatted_value = value ? value.gsub(/"/, "\\\"") : '' unless value.is_a?(Numeric) "#{format_header(header)}: #{formatted_value}" end From 52fffd84f59b78f0442b8aa0c12cdc18120342bc Mon Sep 17 00:00:00 2001 From: prosac Date: Fri, 16 Jun 2017 14:17:40 +0200 Subject: [PATCH 2/2] fixes formatted value setting after change --- lib/rspec_api_documentation/curl.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/rspec_api_documentation/curl.rb b/lib/rspec_api_documentation/curl.rb index af12e2d5..09eea076 100644 --- a/lib/rspec_api_documentation/curl.rb +++ b/lib/rspec_api_documentation/curl.rb @@ -69,7 +69,12 @@ def format_header(header) end def format_full_header(header, value) - formatted_value = value ? value.gsub(/"/, "\\\"") : '' unless value.is_a?(Numeric) + formatted_value = if value.is_a?(Numeric) + value + else + value ? value.gsub(/"/, "\\\"") : '' + end + "#{format_header(header)}: #{formatted_value}" end