Skip to content

Latest commit

 

History

History
31 lines (26 loc) · 567 Bytes

README.md

File metadata and controls

31 lines (26 loc) · 567 Bytes

fasthttp-test

for people who want to do integration test valyala/fasthttp

get

go get github.com/tspn/fasthttp-test

example

func Handler(ctx *fasthttp.RequestCtx){
	ctx.WriteString("example")
}

func TestSimpleGETRequest(t *testing.T){
	resp, body, errs := fasthttp_test.StartServerOnPort(t, fasthttp_test.GET, "/example", 9000, Handler, nil)

	if errs != nil {
		for _, err := range errs {
			t.Error(err)
		}
	}

	if resp == nil {
		t.Error("Response is nil")
	}

	if body != "example" {
		t.Error("expected example but got", body)
	}
}