httpin
httpin copied to clipboard
Add support for `omitempty` field tag to exclude empty values from queries and headers
Adds support for an omitempty
tag.
Main use case is for query parameters where we may not want have empty keys
i.e. /pets?name_pointer=
By adding omitempty
to the tag then this the key will not appear in the query string
i.e.
type SearchQuery struct {
NamePointer *string `in:"query=name_pointer,omitempty"`
}
This will create /pets
This has been added to the formencoder
so that it will also remove empty headers.
I have picked omitempty
as I feel this will feel most natural for engineers as they are likely already used to this syntax with JSON.