MCPcopy Create free account
hub / github.com/003random/getJS / resolve

Function resolve

extractor/extractor.go:124–133  ·  view source on GitHub ↗

resolve checks if the provided URL resolves successfully.

(source url.URL)

Source from the content-addressed store, hash-verified

122
123// resolve checks if the provided URL resolves successfully.
124func resolve(source url.URL) bool {
125 resp, err := http.Get(source.String())
126 if err != nil {
127 return false
128 }
129 defer resp.Body.Close()
130
131 _, err = io.Copy(io.Discard, resp.Body)
132 return err == nil && (resp.StatusCode >= http.StatusOK && resp.StatusCode < http.StatusMultipleChoices)
133}

Callers 1

WithResolveFunction · 0.85

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected