40 lines
652 B
Go
Raw Permalink Normal View History

2022-03-07 20:49:02 +08:00
package main
import (
cli "goa_example/gen/http/cli/host"
"net/http"
"time"
goahttp "goa.design/goa/v3/http"
goa "goa.design/goa/v3/pkg"
)
func doHTTP(scheme, host string, timeout int, debug bool) (goa.Endpoint, interface{}, error) {
var (
doer goahttp.Doer
)
{
doer = &http.Client{Timeout: time.Duration(timeout) * time.Second}
if debug {
doer = goahttp.NewDebugDoer(doer)
}
}
return cli.ParseEndpoint(
scheme,
host,
doer,
goahttp.RequestEncoder,
goahttp.ResponseDecoder,
debug,
)
}
func httpUsageCommands() string {
return cli.UsageCommands()
}
func httpUsageExamples() string {
return cli.UsageExamples()
}