Commit 93b30137 authored by Matthew Holt's avatar Matthew Holt

rewrite: Fix a lint suggestion

parent ce4981d0
...@@ -13,12 +13,12 @@ import ( ...@@ -13,12 +13,12 @@ import (
"github.com/mholt/caddy/middleware" "github.com/mholt/caddy/middleware"
) )
// RewriteResult is the result of a rewrite // Result is the result of a rewrite
type RewriteResult int type Result int
const ( const (
// RewriteIgnored is returned when rewrite is not done on request. // RewriteIgnored is returned when rewrite is not done on request.
RewriteIgnored RewriteResult = iota RewriteIgnored Result = iota
// RewriteDone is returned when rewrite is done on request. // RewriteDone is returned when rewrite is done on request.
RewriteDone RewriteDone
// RewriteStatus is returned when rewrite is not needed and status code should be set // RewriteStatus is returned when rewrite is not needed and status code should be set
...@@ -55,7 +55,7 @@ outer: ...@@ -55,7 +55,7 @@ outer:
// Rule describes an internal location rewrite rule. // Rule describes an internal location rewrite rule.
type Rule interface { type Rule interface {
// Rewrite rewrites the internal location of the current request. // Rewrite rewrites the internal location of the current request.
Rewrite(http.FileSystem, *http.Request) RewriteResult Rewrite(http.FileSystem, *http.Request) Result
} }
// SimpleRule is a simple rewrite rule. // SimpleRule is a simple rewrite rule.
...@@ -69,7 +69,7 @@ func NewSimpleRule(from, to string) SimpleRule { ...@@ -69,7 +69,7 @@ func NewSimpleRule(from, to string) SimpleRule {
} }
// Rewrite rewrites the internal location of the current request. // Rewrite rewrites the internal location of the current request.
func (s SimpleRule) Rewrite(fs http.FileSystem, r *http.Request) RewriteResult { func (s SimpleRule) Rewrite(fs http.FileSystem, r *http.Request) Result {
if s.From == r.URL.Path { if s.From == r.URL.Path {
// take note of this rewrite for internal use by fastcgi // take note of this rewrite for internal use by fastcgi
// all we need is the URI, not full URL // all we need is the URI, not full URL
...@@ -136,7 +136,7 @@ func NewComplexRule(base, pattern, to string, status int, ext []string, ifs []If ...@@ -136,7 +136,7 @@ func NewComplexRule(base, pattern, to string, status int, ext []string, ifs []If
} }
// Rewrite rewrites the internal location of the current request. // Rewrite rewrites the internal location of the current request.
func (r *ComplexRule) Rewrite(fs http.FileSystem, req *http.Request) (re RewriteResult) { func (r *ComplexRule) Rewrite(fs http.FileSystem, req *http.Request) (re Result) {
rPath := req.URL.Path rPath := req.URL.Path
replacer := newReplacer(req) replacer := newReplacer(req)
......
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
// To attempts rewrite. It attempts to rewrite to first valid path // To attempts rewrite. It attempts to rewrite to first valid path
// or the last path if none of the paths are valid. // or the last path if none of the paths are valid.
// Returns true if rewrite is successful and false otherwise. // Returns true if rewrite is successful and false otherwise.
func To(fs http.FileSystem, r *http.Request, to string, replacer middleware.Replacer) RewriteResult { func To(fs http.FileSystem, r *http.Request, to string, replacer middleware.Replacer) Result {
tos := strings.Fields(to) tos := strings.Fields(to)
// try each rewrite paths // try each rewrite paths
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment