diff --git a/lib/rspec_api_documentation/curl.rb b/lib/rspec_api_documentation/curl.rb index 606fdfab..bbd1a763 100644 --- a/lib/rspec_api_documentation/curl.rb +++ b/lib/rspec_api_documentation/curl.rb @@ -40,7 +40,8 @@ def get_data end def post_data - "-d \"#{data}\"" + escaped_data = data.to_s.gsub("'", "\\u0027") + "-d '#{escaped_data}'" end private diff --git a/spec/curl_spec.rb b/spec/curl_spec.rb index aeb38172..bbefec3e 100644 --- a/spec/curl_spec.rb +++ b/spec/curl_spec.rb @@ -13,7 +13,7 @@ it { should =~ /^curl/ } it { should =~ /http:\/\/example\.com\/orders/ } - it { should =~ /-d "order%5Bsize%5D=large&order%5Btype%5D=cart"/ } + it { should =~ /-d 'order%5Bsize%5D=large&order%5Btype%5D=cart'/ } it { should =~ /-X POST/ } it { should =~ /-H "Accept: application\/json"/ } it { should =~ /-H "X-Header: header"/ } @@ -50,7 +50,7 @@ it { should =~ /^curl/ } it { should =~ /http:\/\/example\.com\/orders\/1/ } - it { should =~ /-d "size=large"/ } + it { should =~ /-d 'size=large'/ } it { should =~ /-X PUT/ } it { should =~ /-H "Accept: application\/json"/ } it { should =~ /-H "X-Header: header"/ }