Skip to content

Instantly share code, notes, and snippets.

@JamesSc0tt
Last active February 8, 2024 15:46
Show Gist options
  • Save JamesSc0tt/974f7ca34e5c8772521b02efbc4bb409 to your computer and use it in GitHub Desktop.
Save JamesSc0tt/974f7ca34e5c8772521b02efbc4bb409 to your computer and use it in GitHub Desktop.
HTTP status codes as bash array
# found this useful at work, probably will be useful again
declare -a http_code
http_code[000]="Unknown"
http_code[100]="Continue"
http_code[101]="Switching Protocols"
http_code[200]="OK"
http_code[201]="Created"
http_code[202]="Accepted"
http_code[203]="Non-Authoritative Information"
http_code[204]="No Content"
http_code[205]="Reset Content"
http_code[206]="Partial Content"
http_code[300]="Multiple Choices"
http_code[301]="Moved Permanently"
http_code[302]="Found"
http_code[303]="See Other"
http_code[304]="Not Modified"
http_code[305]="Use Proxy"
http_code[307]="Temporary Redirect"
http_code[400]="Bad Request"
http_code[401]="Unauthorized"
http_code[402]="Payment Required"
http_code[403]="Forbidden"
http_code[404]="Not Found"
http_code[405]="Method Not Allowed"
http_code[406]="Not Acceptable"
http_code[407]="Proxy Authentication Required"
http_code[408]="Request Timeout"
http_code[409]="Conflict"
http_code[410]="Gone"
http_code[411]="Length Required"
http_code[412]="Precondition Failed"
http_code[413]="Payload Too Large"
http_code[414]="URI Too Long"
http_code[415]="Unsupported Media Type"
http_code[416]="Range Not Satisfiable"
http_code[417]="Expectation Failed"
http_code[418]="I'm a teapot"
http_code[426]="Upgrade Required"
http_code[500]="Internal Server Error"
http_code[501]="Not Implemented"
http_code[502]="Bad Gateway"
http_code[503]="Service Unavailable"
http_code[504]="Gateway Time-out"
http_code[505]="HTTP Version Not Supported"
http_code[102]="Processing"
http_code[207]="Multi-Status"
http_code[226]="IM Used"
http_code[308]="Permanent Redirect"
http_code[422]="Unprocessable Entity"
http_code[423]="Locked"
http_code[424]="Failed Dependency"
http_code[428]="Precondition Required"
http_code[429]="Too Many Requests"
http_code[431]="Request Header Fields Too Large"
http_code[451]="Unavailable For Legal Reasons"
http_code[506]="Variant Also Negotiates"
http_code[507]="Insufficient Storage"
http_code[511]="Network Authentication Required"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment