MCPcopy
hub / github.com/caddyserver/caddy / changePath

Function changePath

modules/caddyhttp/rewrite/rewrite.go:509–520  ·  view source on GitHub ↗
(req *http.Request, newVal func(pathOrRawPath string) string)

Source from the content-addressed store, hash-verified

507}
508
509func changePath(req *http.Request, newVal func(pathOrRawPath string) string) {
510 req.URL.RawPath = newVal(req.URL.EscapedPath())
511 if p, err := url.PathUnescape(req.URL.RawPath); err == nil && p != "" {
512 req.URL.Path = p
513 } else {
514 req.URL.Path = newVal(req.URL.Path)
515 }
516 // RawPath is only set if it's different from the normalized Path (std lib)
517 if req.URL.RawPath == req.URL.Path {
518 req.URL.RawPath = ""
519 }
520}
521
522// queryOps describes the operations to perform on query keys: add, set, rename and delete.
523type queryOps struct {

Callers 3

RewriteMethod · 0.85
doMethod · 0.85
doMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected