NewHandlerCmd creates a HandlerCmd for the provided request and callback handler function.
(method, rawURL string, fn func(*Context, *http.Response, error))
| 75 | // NewHandlerCmd creates a HandlerCmd for the provided request and callback |
| 76 | // handler function. |
| 77 | func 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. |