Skip to content

net/url: add Values.Has(key) #45100

Closed
Closed
@iann0036

Description

@iann0036

There is currently no inbuilt method within Values of detecting whether a query parameter without a value is set (e.g. http://example.com/?queryname).

I propose adding the following method to determine whether a specific key is set:

// Checks whether a given key is set.
func (v Values) IsSet(key string) bool {
	if _, ok := v[key]; ok {
		return true
	}
	return false
}

This would also work for query parameters with values.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions