fix "modifer" -> "modifier" typo everywhere
This commit is contained in:
26
proxychain/requestmodifiers/modify_query_params.go
Normal file
26
proxychain/requestmodifiers/modify_query_params.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package requestmodifiers
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
"ladder/proxychain"
|
||||
)
|
||||
|
||||
// ModifyQueryParams replaces query parameter values in URL's query params in a ProxyChain's URL.
|
||||
// If the query param key doesn't exist, it is created.
|
||||
func ModifyQueryParams(key string, value string) proxychain.RequestModification {
|
||||
return func(chain *proxychain.ProxyChain) error {
|
||||
q := chain.Request.URL.Query()
|
||||
chain.Request.URL.RawQuery = modifyQueryParams(key, value, q)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func modifyQueryParams(key string, value string, q url.Values) string {
|
||||
if value == "" {
|
||||
q.Del(key)
|
||||
return q.Encode()
|
||||
}
|
||||
q.Set(key, value)
|
||||
return q.Encode()
|
||||
}
|
||||
Reference in New Issue
Block a user