Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default statusMessage #187

Closed
maicss opened this issue Oct 10, 2022 · 2 comments · Fixed by #195
Closed

Add default statusMessage #187

maicss opened this issue Oct 10, 2022 · 2 comments · Fixed by #195
Labels
enhancement New feature or request

Comments

@maicss
Copy link

maicss commented Oct 10, 2022

401 = Unauthorized
402 = Payment Required
403 = Forbidden
404 = Not Found
...
And so on.

For now code like this:

createError({
  statusCode: 401
})

return:

{
  "url": "/api/login",
  "statusCode": 401,
  "statusMessage": "Internal Server Error",
  "message": "Error",
  "stack": "..."
}

image

@maicss
Copy link
Author

maicss commented Oct 10, 2022

[
    {
        "100": "Continue"
    },
    {
        "101": "Switching Protocols"
    },
    {
        "102": "Processing"
    },
    {
        "200": "OK"
    },
    {
        "201": "Created"
    },
    {
        "202": "Accepted"
    },
    {
        "203": "Non-Authoritative Information"
    },
    {
        "204": "No Content"
    },
    {
        "205": "Reset Content"
    },
    {
        "206": "Partial Content"
    },
    {
        "207": "Multi-Status"
    },
    {
        "208": "Already Reported"
    },
    {
        "226": "IM Used"
    },
    {
        "300": "Multiple Choices"
    },
    {
        "301": "Moved Permanently"
    },
    {
        "302": "Found"
    },
    {
        "303": "See Other"
    },
    {
        "304": "Not Modified"
    },
    {
        "305": "Use Proxy"
    },
    {
        "307": "Temporary Redirect"
    },
    {
        "308": "Permanent Redirect"
    },
    {
        "400": "Bad Request"
    },
    {
        "401": "Unauthorized"
    },
    {
        "402": "Payment Required"
    },
    {
        "403": "Forbidden"
    },
    {
        "404": "Not Found"
    },
    {
        "405": "Method Not Allowed"
    },
    {
        "406": "Not Acceptable"
    },
    {
        "407": "Proxy Authentication Required"
    },
    {
        "408": "Request Timeout"
    },
    {
        "409": "Conflict"
    },
    {
        "410": "Gone"
    },
    {
        "411": "Length Required"
    },
    {
        "412": "Precondition Failed"
    },
    {
        "413": "Request Entity Too Large"
    },
    {
        "414": "Request-URI Too Long"
    },
    {
        "415": "Unsupported Media Type"
    },
    {
        "416": "Requested Range Not Satisfiable"
    },
    {
        "417": "Expectation Failed"
    },
    {
        "418": "I'm a teapot"
    },
    {
        "420": "Enhance Your Calm"
    },
    {
        "422": "Unprocessable Entity"
    },
    {
        "423": "Locked"
    },
    {
        "424": "Failed Dependency"
    },
    {
        "426": "Upgrade Required"
    },
    {
        "428": "Precondition Required"
    },
    {
        "429": "Too Many Requests"
    },
    {
        "431": "Request Header Fields Too Large"
    },
    {
        "444": "No Response"
    },
    {
        "449": "Retry With"
    },
    {
        "450": "Blocked by Windows Parental Controls"
    },
    {
        "451": "Unavailable For Legal Reasons"
    },
    {
        "499": "Client Closed Request"
    },
    {
        "500": "Internal Server Error"
    },
    {
        "501": "Not Implemented"
    },
    {
        "502": "Bad Gateway"
    },
    {
        "503": "Service Unavailable"
    },
    {
        "504": "Gateway Timeout"
    },
    {
        "505": "HTTP Version Not Supported"
    },
    {
        "506": "Variant Also Negotiates"
    },
    {
        "507": "Insufficient Storage"
    },
    {
        "508": "Loop Detected"
    },
    {
        "509": "Bandwidth Limit Exceeded"
    },
    {
        "510": "Not Extended"
    },
    {
        "511": "Network Authentication Required"
    },
    {
        "598": "Network read timeout error"
    },
    {
        "599": "Network connect timeout error"
    }
]

@danielroe danielroe added the enhancement New feature or request label Oct 10, 2022 — with Volta.net
@maicss
Copy link
Author

maicss commented Oct 10, 2022

In fact, just leave statusMessage blank, the browser has this mapping table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants