Open ducdetronquito opened 3 years ago
First rework step made with the PR https://github.com/ducdetronquito/http/pull/7.
The idea is to avoid the complexity of a proper multimap implementation by providing a simple list of headers.
Advantages:
Drawbacks:
Remarks:
As of yet, lookup and addition of headers are case-insensitive for standard headers, but case sensitive for custom headers.
var headers = Headers.init(std.testing.allocator);
defer headers.deinit();
try headers.add("Content-Length", "10");
try headers.add("Gotta-Go", "Fast");
headers.get("Content-Lenght"); // --> OK
headers.get("content-length"); // --> OK
headers.get("Gotta-Go"); // --> OK
headers.get("gotta-go"); // --> KO
The http core types must define a correct header multimap.
Some good work has already been done by @daurnimator and other contributors in the standard library, and I feel like it would be great to embed it within the Zig HTTP core types library.
Pros:
Cons: