UNPKG

http-sarcasm-codes

Version:

Sarcastic, witty responses for HTTP status codes. Perfect for adding humor to APIs.

79 lines (74 loc) โ€ข 4.98 kB
// Sarcastic HTTP Status Codes Library // Inspired by Wikipedia's full list of HTTP status codes export const errorCodes = { // 1xx - Informational 100: "Continue โ€” Server says: 'Go on, Iโ€™m listeningโ€ฆ probably.' ๐Ÿ‘‚", 101: "Switching Protocols โ€” 'Changing my outfit, gimme a sec.' ๐Ÿ‘—๐Ÿ”„", 102: "Processing โ€” 'Slow and steady loses the race.' ๐ŸŒ", 103: "Early Hints โ€” 'Hereโ€™s a teaser before the main show.' ๐ŸŽฌ", // 2xx - Success 200: "OK โ€” 'Everything worked. Iโ€™m as shocked as you are.' โœ…", 201: "Created โ€” 'Congrats, you just made something out of nothing.' ๐ŸŽ‰", 202: "Accepted โ€” 'Not now, but sureโ€ฆ maybe later.' โณ", 203: "Non-Authoritative Information โ€” 'I copied this from someone else.' ๐Ÿ“‹", 204: "No Content โ€” 'Mission accomplishedโ€ฆ but I brought nothing.' ๐Ÿ“ญ", 205: "Reset Content โ€” 'Go ahead, refresh your brain.' ๐Ÿ”„", 206: "Partial Content โ€” 'Hereโ€™s halfโ€ฆ the rest is a mystery.' ๐Ÿงฉ", 207: "Multi-Status โ€” 'Too much info, too little care.' ๐Ÿ“‘", 208: "Already Reported โ€” 'Yeah, yeahโ€ฆ I heard you the first time.' ๐Ÿ”", 226: "IM Used โ€” 'I processed this with some extra magic.' โœจ", // 3xx - Redirection 300: "Multiple Choices โ€” 'Pick oneโ€ฆ I donโ€™t care.' ๐Ÿคทโ€โ™‚๏ธ", 301: "Moved Permanently โ€” 'I live somewhere else now.' ๐Ÿ ", 302: "Found โ€” 'Oh hey, over here!' ๐Ÿ‘‹", 303: "See Other โ€” 'This isnโ€™t the page youโ€™re looking for.' ๐Ÿ›‘", 304: "Not Modified โ€” 'Nothing new, move along.' ๐Ÿšถ", 305: "Use Proxy โ€” 'Talk to my middleman.' ๐Ÿ•ต๏ธโ€โ™‚๏ธ", 307: "Temporary Redirect โ€” 'Just visiting somewhere else for now.' ๐Ÿงณ", 308: "Permanent Redirect โ€” 'Iโ€™ve moved out, donโ€™t send mail here.' ๐Ÿ“ฆ", // 4xx - Client Errors 400: "Bad Request โ€” 'Your request is as broken as my Monday morning.' โ˜•๐Ÿ’ฅ", 401: "Unauthorized โ€” 'Nice try, but no VIP pass for you.' ๐ŸšชโŒ", 402: "Payment Required โ€” 'Show me the money.' ๐Ÿ’ธ", 403: "Forbidden โ€” 'You canโ€™t sit with us.' ๐Ÿšซ", 404: "Not Found โ€” 'Like your favorite penโ€ฆ gone forever.' ๐Ÿ–Š๏ธโœจ", 405: "Method Not Allowed โ€” 'Thatโ€™s not how we do things here.' ๐Ÿ™…", 406: "Not Acceptable โ€” 'Nope, not good enough for my standards.' ๐Ÿ‘‘", 407: "Proxy Authentication Required โ€” 'Ask my bouncer first.' ๐Ÿ•ถ๏ธ", 408: "Request Timeout โ€” 'I got bored and left.' โฐ", 409: "Conflict โ€” 'Thereโ€™s some drama going on.' ๐ŸŽญ", 410: "Gone โ€” 'It was here onceโ€ฆ now itโ€™s just a legend.' ๐Ÿฆ„", 411: "Length Required โ€” 'Tell me how long it is first.' ๐Ÿ“", 412: "Precondition Failed โ€” 'You assumed wrong.' โŒ", 413: "Payload Too Large โ€” 'Woah, slow down Hulk.' ๐Ÿ‹๏ธ", 414: "URI Too Long โ€” 'Your link is extra AF.' ๐Ÿ”—", 415: "Unsupported Media Type โ€” 'I donโ€™t speak that format.' ๐ŸŽฅ", 416: "Range Not Satisfiable โ€” 'That range is out of bounds.' ๐Ÿ“‰", 417: "Expectation Failed โ€” 'Well, that was disappointing.' ๐Ÿ˜”", 418: "Iโ€™m a Teapot โ€” 'Yes, seriously.' ๐Ÿต", 421: "Misdirected Request โ€” 'Oops, wrong address.' ๐Ÿ“ฌ", 422: "Unprocessable Entity โ€” 'I understood it, but I refuse to deal with it.' ๐Ÿ™…โ€โ™€๏ธ", 423: "Locked โ€” 'Mine. You canโ€™t have it.' ๐Ÿ”’", 424: "Failed Dependency โ€” 'I was counting on something elseโ€ฆ and it failed.' ๐Ÿ’”", 425: "Too Early โ€” 'Chill. Youโ€™re too soon.' ๐Ÿ•ฐ๏ธ", 426: "Upgrade Required โ€” 'Please update yourself, dinosaur.' ๐Ÿฆ–", 428: "Precondition Required โ€” 'Not without some ground rules.' ๐Ÿ“œ", 429: "Too Many Requests โ€” 'Calm down, spammer.' ๐Ÿ“ฉ", 431: "Request Header Fields Too Large โ€” 'Your intro is too long, cut it short.' โœ‚๏ธ", 451: "Unavailable For Legal Reasons โ€” 'Shhhโ€ฆ the lawyers said no.' โš–๏ธ", // 5xx - Server Errors 500: "Internal Server Error โ€” 'Itโ€™s not you, itโ€™s me.' ๐Ÿ’”๐Ÿ’ป", 501: "Not Implemented โ€” 'Yeahโ€ฆ I canโ€™t do that.' ๐Ÿ› ๏ธ", 502: "Bad Gateway โ€” 'My friend gave me bad info.' ๐Ÿคฅ", 503: "Service Unavailable โ€” 'On a coffee break. Back later.' โ˜•", 504: "Gateway Timeout โ€” 'My friend took too long to reply.' ๐Ÿข", 505: "HTTP Version Not Supported โ€” 'Thatโ€™s so last season.' ๐Ÿ‘—", 506: "Variant Also Negotiates โ€” 'I argued with myself and lost.' ๐Ÿคฏ", 507: "Insufficient Storage โ€” 'No space left, like my phone.' ๐Ÿ“ฑ", 508: "Loop Detected โ€” 'Iโ€™m stuck in a time loop. Help.' ๐Ÿ”", 510: "Not Extended โ€” 'You need more DLC for this request.' ๐ŸŽฎ", 511: "Network Authentication Required โ€” 'Log into the WiFi first.' ๐Ÿ“ถ", }; export const getErrorMessage = (code) => { return errorCodes[code] || "Unknown Error Code โ€” 'Seriously, what is this?' ๐Ÿคทโ€โ™€๏ธ"; };