File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def paginate(collection)
15
15
pages = ApiPagination . pages_from ( collection )
16
16
17
17
pages . each do |k , v |
18
- old_params = Rack ::Utils . parse_query ( request . query_string )
18
+ old_params = Rack ::Utils . parse_nested_query ( request . query_string )
19
19
new_params = old_params . merge ( 'page' => v )
20
20
links << %(<#{ url } ?#{ new_params . to_param } >; rel="#{ k } ")
21
21
end
Original file line number Diff line number Diff line change 99
99
expect ( per_page ) . to eq ( 10 )
100
100
end
101
101
end
102
+
103
+ context 'with query string including array parameter' do
104
+ before do
105
+ get '/numbers' , { count : 100 , parity : [ 'odd' , 'even' ] }
106
+ end
107
+
108
+ it 'returns links with with same received parameters' do
109
+ expect ( links ) . to include ( '<http://example.org/numbers?count=100&page=10&parity%5B%5D=odd&parity%5B%5D=even>; rel="last"' )
110
+ expect ( links ) . to include ( '<http://example.org/numbers?count=100&page=2&parity%5B%5D=odd&parity%5B%5D=even>; rel="next"' )
111
+ end
112
+ end
102
113
end
103
114
end
You can’t perform that action at this time.
0 commit comments