MCPcopy
hub / github.com/valyala/fasthttp / testRequestHeaderMethod

Function testRequestHeaderMethod

header_test.go:2920–2939  ·  view source on GitHub ↗
(t *testing.T, expectedMethod string)

Source from the content-addressed store, hash-verified

2918}
2919
2920func testRequestHeaderMethod(t *testing.T, expectedMethod string) {
2921 var h RequestHeader
2922 h.SetMethod(expectedMethod)
2923 h.SetHost("example.com")
2924 m := h.Method()
2925 if string(m) != expectedMethod {
2926 t.Fatalf("unexpected method: %q. Expecting %q", m, expectedMethod)
2927 }
2928
2929 s := h.String()
2930 var h1 RequestHeader
2931 br := bufio.NewReader(bytes.NewBufferString(s))
2932 if err := h1.Read(br); err != nil {
2933 t.Fatalf("unexpected error: %v", err)
2934 }
2935 m1 := h1.Method()
2936 if !bytes.Equal(m, m1) {
2937 t.Fatalf("unexpected method: %q. Expecting %q", m, m1)
2938 }
2939}
2940
2941func TestRequestHeaderSetGet(t *testing.T) {
2942 t.Parallel()

Callers 1

TestRequestHeaderMethodFunction · 0.85

Calls 6

SetMethodMethod · 0.95
SetHostMethod · 0.95
MethodMethod · 0.95
StringMethod · 0.95
ReadMethod · 0.95
NewReaderMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…