Skip to content

Commit

Permalink
Rewrite struct Changed QueryOperations field to Query and comments cl…
Browse files Browse the repository at this point in the history
…eanup
  • Loading branch information
armadi1809 committed Mar 3, 2024
1 parent a040993 commit afbcbc2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions modules/caddyhttp/rewrite/rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ type Rewrite struct {
// Performs regular expression replacements on the URI path.
PathRegexp []*regexReplacer `json:"path_regexp,omitempty"`

// Performs query parameters operations on the URI path
QueryOperations *queryOps `json:"query_operations,omitempty"`
// Mutates the query string of the URI.

Query *queryOps `json:"query_operations,omitempty"`

logger *zap.Logger
}
Expand Down Expand Up @@ -273,8 +274,8 @@ func (rewr Rewrite) Rewrite(r *http.Request, repl *caddy.Replacer) bool {
}

// apply query operations
if rewr.QueryOperations != nil {
rewr.QueryOperations.do(r, repl)
if rewr.Query != nil {
rewr.Query.do(r, repl)
}

// update the encoded copy of the URI
Expand Down Expand Up @@ -536,6 +537,7 @@ func (q *queryOps) do(r *http.Request, repl *caddy.Replacer) {
}

type queryOpsArguments struct {
// A key in the query string. Note that query string keys may appear multiple times.
Key string `json:"key,omitempty"`
Val string `json:"val,omitempty"`
}
Expand Down

0 comments on commit afbcbc2

Please sign in to comment.