A fork of Gitea (see branch `mj`) adding Majority Judgment Polls 𐄷 over Issues and Merge Requests. https://git.mieuxvoter.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
790 B

  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package public
  5. import (
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. )
  9. func TestParseAcceptEncoding(t *testing.T) {
  10. var kases = []struct {
  11. Header string
  12. Expected map[string]bool
  13. }{
  14. {
  15. Header: "deflate, gzip;q=1.0, *;q=0.5",
  16. Expected: map[string]bool{
  17. "deflate": true,
  18. "gzip": true,
  19. },
  20. },
  21. {
  22. Header: " gzip, deflate, br",
  23. Expected: map[string]bool{
  24. "deflate": true,
  25. "gzip": true,
  26. "br": true,
  27. },
  28. },
  29. }
  30. for _, kase := range kases {
  31. t.Run(kase.Header, func(t *testing.T) {
  32. assert.EqualValues(t, kase.Expected, parseAcceptEncoding(kase.Header))
  33. })
  34. }
  35. }