Skip to content

Get codes, phrases and descriptions dynamically instead of hard-coding #16

@MestreLion

Description

@MestreLion

Considering this:

# Codes with messages are taken verbatim from BaseHTTPServer.py

# Table mapping response codes to messages; entries have the
# form {code: (shortmessage, longmessage)}.
# See RFC 2616.
STATUS_CODES = {
    100: ('Continue', 'Request received, please continue'),

Why the trouble to hardcode it?

import http
STATUS_CODES = {sc.value: (sc.phrase, sc.description) for sc in http.HTTPStatus}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions