I'm currently adapting Genie/Stipple to v2 of HTTP and found it would be very helpful to define
function Base.setindex!(headers::Headers, value, key::Union{Symbol, AbstractString})
item = _header_pair(key, value)
k = first(item)
res = findfirst(x -> first(x) == k, headers.entries)
if res !== nothing
headers[res] = item
else
push!(headers.entries, item)
end
end
function Base.merge!(headers::Headers, items)
for (k,v) in items
headers[k] = v
end
return headers
end
Moreover, I'd appreciate
elseif headers_input isa Pair
_append_header_values!(headers, headers_input.first, headers_input.second)
return headers
end
in mkheaders()
and maybe
Headers(item::Pair) = mkheaders((item,))
Headers(items...) = mkheaders(items)
in order to support the more natural
Headers(:a => :b)
Headers(:a => :b, :c => "d")
What do you think?
I'm currently adapting Genie/Stipple to v2 of HTTP and found it would be very helpful to define
Moreover, I'd appreciate
in
mkheaders()and maybe
in order to support the more natural
What do you think?