http becomes an internal package

This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-10-03 14:12:14 +02:00
parent 0144569f58
commit 681ee3cba8
5 changed files with 1 additions and 1 deletions
+48
View File
@@ -0,0 +1,48 @@
package http
import (
nethttp "net/http"
"testing"
)
func TestEmptyReasonWhenEmptyString(t *testing.T) {
r := &nethttp.Response{Status: ""}
if GetReason(r) != "" {
t.Errorf("We consider an empty status line to have an empty reason")
}
}
func TestEmptyReasonWhenOnlyCode(t *testing.T) {
r := &nethttp.Response{Status: "200"}
if GetReason(r) != "" {
t.Errorf("We consider an status line with just the status code to have an empty reason")
}
}
func TestEmptyReasonWhenOnlyCodePlusSpace(t *testing.T) {
r := &nethttp.Response{Status: "200 "}
if GetReason(r) != "" {
t.Errorf("We consider an status line with just the status code to have an empty reason")
}
}
func TestReasonOfOneWord(t *testing.T) {
r := &nethttp.Response{Status: "200 FOO"}
if GetReason(r) != "FOO" {
t.Errorf("Unexpected reason found")
}
}
func TestReasonOfMultipleWords(t *testing.T) {
r := &nethttp.Response{Status: "200 FOO BAR BAZ"}
if GetReason(r) != "FOO BAR BAZ" {
t.Errorf("Unexpected reason found")
}
}
func TestOddSizeStatusCode(t *testing.T) {
r := &nethttp.Response{Status: "2 FOO BAR BAZ"}
if GetReason(r) != "FOO BAR BAZ" {
t.Errorf("Unexpected reason found")
}
}