MCPcopy Create free account
hub / github.com/PuerkitoBio/fetchbot / NewHandlerCmd

Function NewHandlerCmd

cmd.go:77–83  ·  view source on GitHub ↗

NewHandlerCmd creates a HandlerCmd for the provided request and callback handler function.

(method, rawURL string, fn func(*Context, *http.Response, error))

Source from the content-addressed store, hash-verified

75// NewHandlerCmd creates a HandlerCmd for the provided request and callback
76// handler function.
77func NewHandlerCmd(method, rawURL string, fn func(*Context, *http.Response, error)) (*HandlerCmd, error) {
78 parsedURL, err := url.Parse(rawURL)
79 if err != nil {
80 return nil, err
81 }
82 return &HandlerCmd{&Cmd{parsedURL, method}, HandlerFunc(fn)}, nil
83}
84
85// robotCommand is a "sentinel type" used to distinguish the automatically enqueued robots.txt
86// command from the user-enqueued commands.

Callers 1

TestHandlerCmdFunction · 0.85

Calls 1

HandlerFuncFuncType · 0.85

Tested by 1

TestHandlerCmdFunction · 0.68