github.com/wangkui503/aero@v1.0.0/RewriteContext.go (about)

     1  package aero
     2  
     3  import "net/http"
     4  
     5  // RewriteContext is used for the URI rewrite ability.
     6  type RewriteContext struct {
     7  	Request *http.Request
     8  }
     9  
    10  // URI returns the relative path, e.g. /blog/post/123.
    11  func (ctx *RewriteContext) URI() string {
    12  	return ctx.Request.URL.Path
    13  }
    14  
    15  // SetURI sets the relative path, e.g. /blog/post/123.
    16  func (ctx *RewriteContext) SetURI(b string) {
    17  	ctx.Request.URL.Path = b
    18  }