summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--go.mod3
-rw-r--r--message.go2
-rw-r--r--request_test.go4
3 files changed, 6 insertions, 3 deletions
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..8e55b66
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,3 @@
+module contnet.org/lib/cnp-go
+
+go 1.12
diff --git a/message.go b/message.go
index ccd455f..d3a222d 100644
--- a/message.go
+++ b/message.go
@@ -77,7 +77,7 @@ func (msg *Message) Close() error {
// ComputeLength sets the length header parameter based on the message body.
// First, msg.TryComputeLength() is attempted; if that fails, the request is
-// fully read into a bytes.Buffer and msg.Body is set to it.
+// fully read into a bytes.Reader and msg.Body is set to it.
func (msg *Message) ComputeLength() error {
if !msg.TryComputeLength() {
buf, err := ioutil.ReadAll(msg.Body)
diff --git a/request_test.go b/request_test.go
index 23b8ac0..8a1ceb1 100644
--- a/request_test.go
+++ b/request_test.go
@@ -158,7 +158,7 @@ var requestURLTests = []requestURLTest{
{"/example.com/path/", "", "/example.com/path/", nil},
{"/foo/bar", "", "/foo/bar", nil},
{"/", "", "/", nil},
- {"cnp://example.com/ ™☺)\n", "example.com", "/ ™☺)\n", nil},
+ {"cnp://example.com/ ん™☺)%0A", "example.com", "/ ん™☺)\n", nil},
{"cnp://œ¤å₥¶ḹə.©°ɱ/baz/../foo/.//bar////.//../bar//", "œ¤å₥¶ḹə.©°ɱ", "/foo/bar/", nil},
{"cnp://foo/bar/", "foo", "/bar/", nil},
{"cnp:///foo/bar/", "", "/foo/bar/", nil},
@@ -311,7 +311,7 @@ var urlTests = map[string]string{
"[::1]/foo bar": "cnp://[::1]/foo%20bar",
"[2001:db8::7334]/foo\nbar": "cnp://[2001:db8::7334]/foo%0Abar",
"example.com/qwe asd": "cnp://example.com/qwe%20asd",
- "example.com/ ™☺)\n": "cnp://example.com/%20%E2%84%A2%E2%98%BA%29%0A",
+ "example.com/ ん™☺)\n": "cnp://example.com/%20%E3%82%93%E2%84%A2%E2%98%BA%29%0A",
}
func TestRequestURL(t *testing.T) {