karlseguin / http.zig

An HTTP/1.1 server for zig
MIT License
454 stars 31 forks source link

HTTP - StatusCode [question] #40

Closed kassane closed 5 months ago

kassane commented 5 months ago

Hi @karlseguin,

My question is

In: https://github.com/karlseguin/http.zig/blob/1762121e5ff1791d5405c4484f5958b329eb9c39/src/response.zig#L27

Why not std.http.Status? It's [enum(u10)].

Suggestion: Open discussion and transfer the questions.

karlseguin commented 5 months ago

I think http.zig predates that type. I'm also not sure what the enum gets you. If someone has a reason to use status code 111, I don't intend to make it hard for them,.

kassane commented 5 months ago

I think http.zig predates that type. I'm also not sure what the enum gets you.

Again, it's not a problem for me. And I agree with what has been said.

It's just the convenience of the type.

Even in your tests, there may be non-existent status numbers from std.http.Status. In my fork, changing this would require completely changing some points of the status tests.