Skip to content

Commit

Permalink
Merge pull request voxpupuli#551 from sbaryakov/master
Browse files Browse the repository at this point in the history
sort add_header values for vhost
  • Loading branch information
jfryman committed Feb 5, 2015
2 parents dbfb9d7 + d04f6fc commit ad45bce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions spec/defines/resource_vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,21 @@

it { is_expected.to contain_concat('/etc/nginx/sites-available/www_rspec-vhost_com.conf') }
end

context 'when add_header is set' do
let :params do default_params.merge({
:add_header => { 'header3' => 'test value 3', 'header2' => 'test value 2', 'header1' => 'test value 1' }
}) end

it 'should have correctly ordered entries in the config' do
is_expected.to contain_concat__fragment("#{title}-header").with_content(/
%r|
\s+add_header\s+header1 test value 1;\n
\s+add_header\s+header2 test value 2;\n
\s+add_header\s+header3 test value 3;\n
|/)
end
end
end
end
end
4 changes: 2 additions & 2 deletions templates/vhost/vhost_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ server {
resolver <% Array(@resolver).each do |r| %> <%= r %><% end %>;
<% end -%>
<% if @add_header -%>
<%- @add_header.each do |key,value| -%>
add_header <%= key %> <%= value %>;
<%- @add_header.keys.sort.each do |key| -%>
add_header <%= key %> <%= @add_header[key] %>;
<%- end -%>
<% end -%>
<% if @rewrite_to_https -%>
Expand Down

0 comments on commit ad45bce

Please sign in to comment.