Skip to content

Instantly share code, notes, and snippets.

@rafaelqueiroz88
Last active February 18, 2025 20:18
Show Gist options
  • Save rafaelqueiroz88/665a1db225306209ed6a226b55717a51 to your computer and use it in GitHub Desktop.
Save rafaelqueiroz88/665a1db225306209ed6a226b55717a51 to your computer and use it in GitHub Desktop.
All possible Http status code
class HttpStatusMapper {
// can't be 'continue' because it is reserved name
static const Map<String, dynamic> continueCode = {
'status': 'continue',
'code': 100,
};
static const Map<String, dynamic> switchingProtocols = {
'status': 'Switching Protocols',
'code': 101,
};
static const Map<String, dynamic> processing = {
'status': 'Processing',
'code': 102,
};
static const Map<String, dynamic> ok = {
'status': 'Ok',
'code': 200,
};
static const Map<String, dynamic> created = {
'status': 'Created',
'code': 201,
};
static const Map<String, dynamic> accepted = {
'status': 'Accepted',
'code': 202,
};
static const Map<String, dynamic> nonAuthoritative = {
'status': 'Non Authoritative',
'code': 203,
};
static const Map<String, dynamic> noContent = {
'status': 'No Content',
'code': 204,
};
static const Map<String, dynamic> resetContent = {
'status': 'Reset Content',
'code': 205,
};
static const Map<String, dynamic> partialContent = {
'status': 'Partial Content',
'code': 206,
};
static const Map<String, dynamic> multiStatus = {
'status': 'Multi Status',
'code': 207,
};
static const Map<String, dynamic> alreadyReported = {
'status': 'Already Reported',
'code': 208,
};
static const Map<String, dynamic> imUsed = {
'status': 'I\' Used',
'code': 226,
};
static const Map<String, dynamic> multipleChoices = {
'status': 'Multiple Choices',
'code': 300,
};
static const Map<String, dynamic> movedPermanently = {
'status': 'Moved Permanently',
'code': 301,
};
static const Map<String, dynamic> found = {
'status': 'Found',
'code': 302,
};
static const Map<String, dynamic> seeOther = {
'status': 'See Other',
'code': 303,
};
static const Map<String, dynamic> notModified = {
'status': 'Not Modified',
'code': 304,
};
static const Map<String, dynamic> useProxy = {
'status': 'Use Proxy',
'code': 305,
};
static const Map<String, dynamic> temporaryRedirect = {
'status': 'Temporary Redirect',
'code': 307,
};
static const Map<String, dynamic> permanentRedirect = {
'status': 'Permanent Redirect',
'code': 308,
};
static const Map<String, dynamic> badrequest = {
'status': 'Bad Request',
'code': 400,
};
static const Map<String, dynamic> unauthorized = {
'status': 'Unauthorized',
'code': 401,
};
static const Map<String, dynamic> paymentRequired = {
'status': 'Payment Required',
'code': 402,
};
static const Map<String, dynamic> forbidden = {
'status': 'Forbidden',
'code': 403,
};
static const Map<String, dynamic> notFound = {
'status': 'Not Found',
'code': 404,
};
static const Map<String, dynamic> methodNotAllowed = {
'status': 'Method Not Allowed',
'code': 405,
};
static const Map<String, dynamic> notAcceptable = {
'status': 'Not Acceptable',
'code': 406,
};
static const Map<String, dynamic> proxyAuthenticationRequired = {
'status': 'Proxy Authentication Required',
'code': 407,
};
static const Map<String, dynamic> requestTimeout = {
'status': 'Request Timeout',
'code': 408,
};
static const Map<String, dynamic> conflict = {
'status': 'Conflict',
'code': 409,
};
static const Map<String, dynamic> gone = {
'status': 'Gone',
'code': 410,
};
static const Map<String, dynamic> lengthRequired = {
'status': 'Length Required',
'code': 411,
};
static const Map<String, dynamic> preconditionFailed = {
'status': 'Precondition Failed',
'code': 412,
};
static const Map<String, dynamic> payloadTooLarge = {
'status': 'Payload Too Large',
'code': 413,
};
static const Map<String, dynamic> uriTooLong = {
'status': 'URI Too Long',
'code': 414,
};
static const Map<String, dynamic> unsupportedMediaType = {
'status': 'Unsupported Media Type',
'code': 415,
};
static const Map<String, dynamic> rangeNotSatisfiable = {
'status': 'Range Not Satisfiable',
'code': 416,
};
static const Map<String, dynamic> expectationFailed = {
'status': 'Expectation Failed',
'code': 417,
};
static const Map<String, dynamic> unprocessableEntity = {
'status': 'Unprocessable Entity',
'code': 422,
};
static const Map<String, dynamic> locked = {
'status': 'Locked',
'code': 423,
};
static const Map<String, dynamic> failedDependency = {
'status': 'Failed Dependency',
'code': 424,
};
static const Map<String, dynamic> upgradeRequired = {
'status': 'Upgrade Required',
'code': 426,
};
static const Map<String, dynamic> preconditionRequired = {
'status': 'Precondition Required',
'code': 428,
};
static const Map<String, dynamic> tooManyRequests = {
'status': 'Too Many Requests',
'code': 429,
};
static const Map<String, dynamic> requestHeaderFieldsTooLarge = {
'status': 'Request Header Fields Too Large',
'code': 431,
};
static const Map<String, dynamic> internalServerError = {
'status': 'Internal Server Error',
'code': 500,
};
static const Map<String, dynamic> notImplemented = {
'status': 'Not Implemented',
'code': 501,
};
static const Map<String, dynamic> badGateway = {
'status': 'Bad Gateway',
'code': 502,
};
static const Map<String, dynamic> serviceUnavailable = {
'status': 'Service Unavailable',
'code': 503,
};
static const Map<String, dynamic> gatewayTimeout = {
'status': 'Gateway Timeout',
'code': 504,
};
static const Map<String, dynamic> httpVersionNotSupported = {
'status': 'Http Version Not Supported',
'code': 505,
};
static const Map<String, dynamic> variantAlsoNegotiates = {
'status': 'Variant Also Negotiates',
'code': 506,
};
static const Map<String, dynamic> insufficientStorage = {
'status': 'Insufficient Storage',
'code': 507,
};
static const Map<String, dynamic> loopDetected = {
'status': 'Loop Detected',
'code': 508,
};
static const Map<String, dynamic> notExtended = {
'status': 'Not Extended',
'code': 510,
};
static const Map<String, dynamic> networkAuthenticationRequired = {
'status': 'Network Authentication Required',
'code': 511,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment