MCPcopy Index your code
hub / github.com/bitfield/script / ExampleDo

Function ExampleDo

script_test.go:2183–2196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2181}
2182
2183func ExampleDo() {
2184 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
2185 fmt.Fprintln(w, "some data")
2186 }))
2187 defer ts.Close()
2188 req, err := http.NewRequest(http.MethodGet, ts.URL, http.NoBody)
2189 if err != nil {
2190 log.Println(err)
2191 return
2192 }
2193 script.Do(req).Stdout()
2194 // Output:
2195 // some data
2196}
2197
2198func ExampleEcho() {
2199 script.Echo("Hello, world!").Stdout()

Callers

nothing calls this directly

Calls 3

DoFunction · 0.92
StdoutMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…