File tree 2 files changed +10
-2
lines changed
lib/rspec_api_documentation
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ def post_data
55
55
private
56
56
def format_header ( header , value )
57
57
formatted_header = header . gsub ( /^HTTP_/ , '' ) . titleize . split . join ( "-" )
58
- "#{ formatted_header } : #{ value } "
58
+ formatted_value = value . gsub ( /"/ , "\\ \" " )
59
+ "#{ formatted_header } : #{ formatted_value } "
59
60
end
60
61
end
61
62
end
Original file line number Diff line number Diff line change 9
9
let ( :method ) { "POST" }
10
10
let ( :path ) { "/orders" }
11
11
let ( :data ) { "order%5Bsize%5D=large&order%5Btype%5D=cart" }
12
- let ( :headers ) { { "HTTP_ACCEPT" => "application/json" , "HTTP_X_HEADER" => "header" } }
12
+ let ( :headers ) do
13
+ {
14
+ "HTTP_ACCEPT" => "application/json" ,
15
+ "HTTP_X_HEADER" => "header" ,
16
+ "HTTP_AUTHORIZATION" => %{Token token="mytoken"}
17
+ }
18
+ end
13
19
14
20
it { should =~ /^curl/ }
15
21
it { should =~ /http:\/ \/ example\. com\/ orders/ }
16
22
it { should =~ /-d 'order%5Bsize%5D=large&order%5Btype%5D=cart'/ }
17
23
it { should =~ /-X POST/ }
18
24
it { should =~ /-H "Accept: application\/ json"/ }
19
25
it { should =~ /-H "X-Header: header"/ }
26
+ it { should =~ /-H "Authorization: Token token=\\ "mytoken\\ ""/ }
20
27
21
28
it "should call post" do
22
29
curl . should_receive ( :post )
You can’t perform that action at this time.
0 commit comments