File: format_test.go

package info (click to toggle)
golang-github-muhlemmer-httpforwarded 0.1.0-2~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 116 kB
  • sloc: makefile: 2
file content (26 lines) | stat: -rw-r--r-- 671 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2016 Tim Heckman. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package httpforwarded_test

import (
	"github.com/muhlemmer/httpforwarded"
	. "gopkg.in/check.v1"
)

func (*TestSuite) TestFormat(c *C) {
	var out string

	out = httpforwarded.Format(nil)
	c.Check(out, Equals, "")

	params := map[string][]string{
		"for":   []string{"192.0.2.1", "192.0.2.4"},
		"by":    []string{"192.0.2.200", "192.0.2.202"},
		"proto": []string{"http"},
	}

	out = httpforwarded.Format(params)
	c.Check(out, Equals, "by=192.0.2.200, by=192.0.2.202; for=192.0.2.1, for=192.0.2.4; proto=http")
}