MCPcopy Create free account
hub / github.com/algolia/cli / Test

Method Test

api/crawler/client.go:316–338  ·  view source on GitHub ↗

Test tests an URL on the specified Crawler.

(crawlerID, URL string, config *Config)

Source from the content-addressed store, hash-verified

314
315// Test tests an URL on the specified Crawler.
316func (c *Client) Test(crawlerID, URL string, config *Config) (*TestResponse, error) {
317 var res TestResponse
318 path := fmt.Sprintf("crawlers/%s/test", crawlerID)
319
320 var body interface{}
321 if config != nil {
322 body = struct {
323 URL string `json:"url"`
324 Config *Config `json:"config"`
325 }{URL, config}
326 } else {
327 body = struct {
328 URL string `json:"url"`
329 }{URL}
330 }
331
332 err := c.request(&res, http.MethodPost, path, body, nil)
333 if err != nil {
334 return nil, err
335 }
336
337 return &res, nil
338}
339
340// CancelTask cancels a blocking task.
341func (c *Client) CancelTask(crawlerID, taskID string) error {

Callers 1

runTestCmdFunction · 0.80

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected