Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/rspec_api_documentation/curl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/curl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"/ }
Expand Down Expand Up @@ -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"/ }
Expand Down