Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sam/harbor
Browse files Browse the repository at this point in the history
Conflicts:
	lib/harbor/request.rb
  • Loading branch information
sam committed Jul 12, 2012
2 parents 248275c + cc2b185 commit a5f4ae7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/harbor/request.rb
Expand Up @@ -137,7 +137,9 @@ def path
def accept
@accept ||= begin
entries = @env['HTTP_ACCEPT'].to_s.split(',')
entries.map { |e| accept_entry(e) }.sort_by { |e| e[1][0] }.map(&:first)
entries.map! { |e| accept_entry(e) }
entries.sort_by! { |e| [e.last, entries.index(e)] }
entries.map(&:first)
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/request_test.rb
Expand Up @@ -27,7 +27,7 @@ def test_params_fetch

def test_extracts_accept_types_preserving_quality_order
request = get("/", { 'HTTP_ACCEPT' => 'text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c, */*; q=0.1' })
expected_accept = ['text/x-c', 'text/html', 'text/x-dvi', 'text/plain', '*/*']
expected_accept = ['text/html', 'text/x-c', 'text/x-dvi', 'text/plain', '*/*']
assert_equal expected_accept, request.accept
end

Expand Down

0 comments on commit a5f4ae7

Please sign in to comment.