From b4f304e0523e46a1518c67b020c7c19d1b5656e7 Mon Sep 17 00:00:00 2001 From: Ian Luo <ian.luo@gmail.com> Date: Tue, 22 Dec 2020 17:10:24 +0800 Subject: [PATCH] introduce DelParam so that it is possible to remove one particular parameter --- common/url.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/url.go b/common/url.go index 2edd71aff..1ea2bc432 100644 --- a/common/url.go +++ b/common/url.go @@ -435,6 +435,13 @@ func (c *URL) SetParam(key string, value string) { c.params.Set(key, value) } +// DelParam will delete the given key from the url +func (c *URL) DelParam(key string) { + c.paramsLock.Lock() + defer c.paramsLock.Unlock() + c.params.Del(key) +} + // ReplaceParams will replace the URL.params // usually it should only be invoked when you want to modify an url, such as MergeURL func (c *URL) ReplaceParams(param url.Values) { -- GitLab