MCPcopy
hub / github.com/yusing/godoxy / AddHTTPRoute

Method AddHTTPRoute

internal/entrypoint/routes.go:119–129  ·  view source on GitHub ↗

AddHTTPRoute adds a HTTP route to the entrypoint's server. If the server does not exist, it will be created, started and return any error.

(route types.HTTPRoute)

Source from the content-addressed store, hash-verified

117//
118// If the server does not exist, it will be created, started and return any error.
119func (ep *Entrypoint) AddHTTPRoute(route types.HTTPRoute) error {
120 httpAddr, httpsAddr := getAddr(route)
121 var httpErr, httpsErr error
122 if httpAddr != "" {
123 httpErr = ep.addHTTPRoute(route, httpAddr, HTTPProtoHTTP)
124 }
125 if httpsAddr != "" {
126 httpsErr = ep.addHTTPRoute(route, httpsAddr, HTTPProtoHTTPS)
127 }
128 return errors.Join(httpErr, httpsErr)
129}
130
131func (ep *Entrypoint) addHTTPRoute(route types.HTTPRoute, addr string, proto HTTPProto) error {
132 return ep.addHTTPRouteWithListener(route, addr, proto, nil)

Callers 1

StartAddRouteMethod · 0.95

Calls 2

addHTTPRouteMethod · 0.95
getAddrFunction · 0.85

Tested by

no test coverage detected