40 lines
652 B
Go
40 lines
652 B
Go
|
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()
|
||
|
}
|