Add HTTP_STATUS_MAP(XX) and enum http_status #337

Closed
wants to merge 1 commit into
from

Projects

None yet

5 participants

@npmccallum
Contributor

This patch provides an enum for the standardized HTTP status codes.
Additionally, the HTTP_STATUS_MAP(XX) can be used for other purposes as well,
such as code-to-name lookups and code-based switch statements.

@npmccallum npmccallum Add HTTP_STATUS_MAP(XX) and enum http_status
This patch provides an enum for the standardized HTTP status codes.
Additionally, the HTTP_STATUS_MAP(XX) can be used for other purposes as well,
such as code-to-name lookups and code-based switch statements.
b03dcbf
@npmccallum
Contributor

For some background, I'm using this in the http://github.com/latchset/tang project. I'm using it for two reasons. First, having named constants for the error codes makes the code more readable. Second, I am using the HTTP_STATUS_MAP(XX) macro in order to create a switch statement for generating reply messages with the appropriate status code text.

I found it useful, and I'm sure that other people will too.

@jhrozek
jhrozek commented Oct 7, 2016

A general +1 to this PR, we're hardcoding a similar lookup table in SSSD as well.

@indutny

LGTM, nice addition.

cc @mscdex and/or @bnoordhuis (would love to get a second LGTM before merging)

@indutny
Member
indutny commented Oct 18, 2016

@npmccallum if no one will reply in 2-3 days - please ping me again, I'll make sure to land it immediately!

@mscdex
mscdex commented Oct 18, 2016

LGTM

@indutny indutny added a commit that referenced this pull request Oct 18, 2016
@npmccallum @indutny npmccallum + indutny parser: HTTP_STATUS_MAP(XX) and enum http_status
This patch provides an enum for the standardized HTTP status codes.
Additionally, the HTTP_STATUS_MAP(XX) can be used for other purposes as
well, such as code-to-name lookups and code-based switch statements.

PR-URL: #337
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
335850f
@indutny
Member
indutny commented Oct 18, 2016

Landed in 335850f, thank you!

@indutny indutny closed this Oct 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment