mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-27 19:06:26 +08:00
Removed Host() and Port() functions from Controller
I don't think they'll be necessary; can get same info from request Host header
This commit is contained in:
parent
feec7c5b40
commit
c7af6725ca
|
@ -42,16 +42,6 @@ func (c *controller) Root() string {
|
|||
}
|
||||
}
|
||||
|
||||
// Host returns the hostname the server is bound to.
|
||||
func (c *controller) Host() string {
|
||||
return c.parser.cfg.Host
|
||||
}
|
||||
|
||||
// Port returns the port that the server is listening on.
|
||||
func (c *controller) Port() string {
|
||||
return c.parser.cfg.Port
|
||||
}
|
||||
|
||||
// Context returns the path scope that the Controller is in.
|
||||
func (c *controller) Context() middleware.Path {
|
||||
return middleware.Path(c.pathScope)
|
||||
|
|
|
@ -30,16 +30,6 @@ func TestController(t *testing.T) {
|
|||
t.Errorf("Expected established root path to be '%s', got '%s'", c.parser.cfg.Root, root)
|
||||
}
|
||||
|
||||
c.parser.cfg.Host = "localhost"
|
||||
if host := c.Host(); host != c.parser.cfg.Host {
|
||||
t.Errorf("Expected host to be '%s', got '%s'", c.parser.cfg.Host, host)
|
||||
}
|
||||
|
||||
c.parser.cfg.Port = "1234"
|
||||
if port := c.Port(); port != c.parser.cfg.Port {
|
||||
t.Errorf("Expected port to be '%s', got '%s'", c.parser.cfg.Port, port)
|
||||
}
|
||||
|
||||
c.pathScope = "unused"
|
||||
if context := c.Context(); string(context) != c.pathScope {
|
||||
t.Errorf("Expected context to be '%s', got '%s'", c.pathScope, context)
|
||||
|
|
|
@ -59,12 +59,6 @@ type (
|
|||
// Root returns the file path from which the server is serving.
|
||||
Root() string
|
||||
|
||||
// Host returns the hostname the server is bound to.
|
||||
Host() string
|
||||
|
||||
// Port returns the port that the server is listening on.
|
||||
Port() string
|
||||
|
||||
// Context returns the path scope that the Controller is in.
|
||||
// Note: This is not currently used, but may be in the future.
|
||||
Context() Path
|
||||
|
|
Loading…
Reference in New Issue
Block a user