http-sarcasm-codes
Version:
Sarcastic, witty responses for HTTP status codes. Perfect for adding humor to APIs.
79 lines (74 loc) โข 4.98 kB
JavaScript
// 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?' ๐คทโโ๏ธ";
};