()
| 2181 | } |
| 2182 | |
| 2183 | func 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 | |
| 2198 | func ExampleEcho() { |
| 2199 | script.Echo("Hello, world!").Stdout() |