sdk/golang/Standard Library/GoNetHttpHttptest
Standard Library

GoNetHttpHttptest

Go stdlib package — net/http/httptest. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

Other Methods

.NewRecorder()Neutral
#
Signature
NewRecorder() *ResponseRecorder

NewRecorder returns an initialized ResponseRecorder.

.NewRequest()Neutral
#
Signature
NewRequest(method string, target string, body io.Reader) *http.Request

NewRequest returns a new incoming server Request, suitable

.NewServer()Neutral
#
Signature
NewServer(handler http.Handler) *Server

NewServer starts and returns a new Server.

.NewTLSServer()Neutral
#
Signature
NewTLSServer(handler http.Handler) *Server

NewTLSServer starts and returns a new Server using TLS.

.NewUnstartedServer()Neutral
#
Signature
NewUnstartedServer(handler http.Handler) *Server

NewUnstartedServer returns a new Server but doesn't start it.

.ResponseRecorder.Flush()Neutral
#
Signature
ResponseRecorder.Flush()

Flush implements http.Flusher. To test whether Flush was

.ResponseRecorder.Header()Neutral
#
Signature
ResponseRecorder.Header() http.Header

Header implements http.ResponseWriter. It returns the response

.ResponseRecorder.Result()Neutral
#
Signature
ResponseRecorder.Result() *http.Response

Result returns the response generated by the handler.

.ResponseRecorder.Write()Neutral
#
Signature
ResponseRecorder.Write(buf []byte) (int, error)

Write implements http.ResponseWriter. The data in buf is written to

.ResponseRecorder.WriteHeader()Neutral
#
Signature
ResponseRecorder.WriteHeader(code int)

WriteHeader implements http.ResponseWriter.

Fully-Qualified Names

FQNField
net/http/httptestfqns[0]

Wrong FQN → 0 findings. Verify with: change fqns to garbage → must produce 0 results.

Import

go.mod
// standard library — no go.mod entry required
rule.py
from codepathfinder.go_rule import ...  # net/http/httptest