MCPcopy
hub / github.com/benbjohnson/wtf / URL

Method URL

http/server.go:154–168  ·  view source on GitHub ↗

URL returns the local base URL of the running server.

()

Source from the content-addressed store, hash-verified

152
153// URL returns the local base URL of the running server.
154func (s *Server) URL() string {
155 scheme, port := s.Scheme(), s.Port()
156
157 // Use localhost unless a domain is specified.
158 domain := "localhost"
159 if s.Domain != "" {
160 domain = s.Domain
161 }
162
163 // Return without port if using standard ports.
164 if (scheme == "http" && port == 80) || (scheme == "https" && port == 443) {
165 return fmt.Sprintf("%s://%s", s.Scheme(), domain)
166 }
167 return fmt.Sprintf("%s://%s:%d", s.Scheme(), domain, s.Port())
168}
169
170// Open validates the server options and begins listening on the bind address.
171func (s *Server) Open() (err error) {

Callers 7

handleDialViewMethod · 0.95
MustNewRequestMethod · 0.95
TestLogin_OAuth_GitHubFunction · 0.80
TestDialIndexFunction · 0.80
TestRedirectToLoginFunction · 0.80
TestCreateDialFunction · 0.80
RunMethod · 0.80

Calls 2

SchemeMethod · 0.95
PortMethod · 0.95

Tested by 5

MustNewRequestMethod · 0.76
TestLogin_OAuth_GitHubFunction · 0.64
TestDialIndexFunction · 0.64
TestRedirectToLoginFunction · 0.64
TestCreateDialFunction · 0.64