MCPcopy Create free account
hub / github.com/goadesign/goa / Scheme

Method Scheme

expr/server.go:272–290  ·  view source on GitHub ↗

Scheme returns the URI scheme. Possible values are http, https, grpc, and grpcs.

()

Source from the content-addressed store, hash-verified

270// Scheme returns the URI scheme. Possible values are http, https, grpc, and
271// grpcs.
272func (u URIExpr) Scheme() string {
273 ustr := string(u)
274 // Did not use url package to find scheme because the url may
275 // contain params (i.e. http://{version}.example.com) which needs
276 // substition for url.Parse to succeed. Also URIs in host must have
277 // a scheme otherwise validations would have failed.
278 switch {
279 case strings.HasPrefix(ustr, "https"):
280 return "https"
281 case strings.HasPrefix(ustr, "grpcs"):
282 return "grpcs"
283 case strings.HasPrefix(ustr, "grpc"):
284 return "grpc"
285 default:
286 // No need to worry about other values because the URIExpr would have failed
287 // validation.
288 return "http"
289 }
290}

Callers 4

SchemesMethod · 0.45
defaultURIFunction · 0.45
buildServersFunction · 0.45
analyzeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected