begin refactor of proxy engine
This commit is contained in:
20
proxychain/rqm/modify_query_params.go
Normal file
20
proxychain/rqm/modify_query_params.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package rqm // ReQuestModifier
|
||||
|
||||
import (
|
||||
"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(px *proxychain.ProxyChain) error {
|
||||
q := px.Request.URL.Query()
|
||||
if value == "" {
|
||||
q.Del(key)
|
||||
return nil
|
||||
}
|
||||
q.Set(key, value)
|
||||
px.Request.URL.RawQuery = q.Encode()
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user