MCPcopy
hub / github.com/gofiber/fiber / BaseURL

Method BaseURL

ctx.go:110–124  ·  view source on GitHub ↗

BaseURL returns (protocol + host + base path).

()

Source from the content-addressed store, hash-verified

108
109// BaseURL returns (protocol + host + base path).
110func (c *DefaultCtx) BaseURL() string {
111 // TODO: Could be improved: 53.8 ns/op 32 B/op 1 allocs/op
112 // Should work like https://codeigniter.com/user_guide/helpers/url_helper.html
113 if c.baseURI != "" {
114 return c.baseURI
115 }
116 scheme := c.Scheme()
117 host := c.Host()
118 buf := make([]byte, 0, len(scheme)+len("://")+len(host))
119 buf = append(buf, scheme...)
120 buf = append(buf, "://"...)
121 buf = append(buf, host...)
122 c.baseURI = c.app.toString(buf)
123 return c.baseURI
124}
125
126// RequestCtx returns *fasthttp.RequestCtx that carries a deadline
127// a cancellation signal, and other values across API boundaries.

Callers

nothing calls this directly

Calls 3

toStringMethod · 0.80
SchemeMethod · 0.65
HostMethod · 0.65

Tested by

no test coverage detected