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

Method Send

fetch.go:183–197  ·  view source on GitHub ↗

Send enqueues a Command into the Fetcher. If the Queue has been closed, it returns ErrQueueClosed. The Command's URL must have a Host.

(c Command)

Source from the content-addressed store, hash-verified

181// Send enqueues a Command into the Fetcher. If the Queue has been closed, it
182// returns ErrQueueClosed. The Command's URL must have a Host.
183func (q *Queue) Send(c Command) error {
184 if c == nil {
185 return ErrEmptyHost
186 }
187 if u := c.URL(); u == nil || u.Host == "" {
188 return ErrEmptyHost
189 }
190 select {
191 case <-q.closed:
192 return ErrQueueClosed
193 default:
194 q.ch <- c
195 }
196 return nil
197}
198
199// SendString enqueues a method and some URL strings into the Fetcher. It returns an error
200// if the URL string cannot be parsed, or if the Queue has been closed.

Callers 8

sendWithMethodMethod · 0.95
TestCustomCommandFunction · 0.80
TestBasicAuthFunction · 0.80
TestBodyFunction · 0.80
TestHeaderFunction · 0.80
TestFullCmdFunction · 0.80
TestHandlerCmdFunction · 0.80
TestMuxFunction · 0.80

Calls 1

URLMethod · 0.65

Tested by 7

TestCustomCommandFunction · 0.64
TestBasicAuthFunction · 0.64
TestBodyFunction · 0.64
TestHeaderFunction · 0.64
TestFullCmdFunction · 0.64
TestHandlerCmdFunction · 0.64
TestMuxFunction · 0.64