()
| 2425 | } |
| 2426 | |
| 2427 | func ExamplePipe_Get() { |
| 2428 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 2429 | data, err := io.ReadAll(r.Body) |
| 2430 | if err != nil { |
| 2431 | log.Fatal(err) |
| 2432 | } |
| 2433 | fmt.Fprintf(w, "You said: %s", data) |
| 2434 | })) |
| 2435 | defer ts.Close() |
| 2436 | script.Echo("hello").Get(ts.URL).Stdout() |
| 2437 | // Output: |
| 2438 | // You said: hello |
| 2439 | } |
| 2440 | |
| 2441 | func ExamplePipe_Hash() { |
| 2442 | sum, err := script.Echo("hello world").Hash(sha512.New()) |