{"id":13548739,"url":"https://github.com/DartForge/http_status","last_synced_at":"2025-04-02T21:32:11.591Z","repository":{"id":222363653,"uuid":"756769221","full_name":"DartForge/http_status","owner":"DartForge","description":"Constants enumerating the HTTP status codes in Dart. All status codes defined in RFC1945 (HTTP/1.0, RFC2616 (HTTP/1.1), and RFC2518 (WebDAV) are supported.","archived":false,"fork":false,"pushed_at":"2024-05-03T05:26:56.000Z","size":177,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-03T17:40:20.731Z","etag":null,"topics":["dart","http-status","httpstatus"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/http_status","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DartForge.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-13T09:22:34.000Z","updated_at":"2024-05-03T05:24:51.000Z","dependencies_parsed_at":"2024-05-03T05:44:10.175Z","dependency_job_id":"f3130b8f-39e4-4ca5-bc64-6513b5384122","html_url":"https://github.com/DartForge/http_status","commit_stats":null,"previous_names":["dartforge/http_status"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DartForge%2Fhttp_status","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DartForge%2Fhttp_status/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DartForge%2Fhttp_status/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DartForge%2Fhttp_status/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DartForge","download_url":"https://codeload.github.com/DartForge/http_status/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246895889,"owners_count":20851348,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","http-status","httpstatus"],"created_at":"2024-08-01T12:01:13.861Z","updated_at":"2025-04-02T21:32:11.266Z","avatar_url":"https://github.com/DartForge.png","language":"Dart","readme":"# http_status\n\n\u003cp align=\"center\"\u003e\n\n[![Pub Package](https://img.shields.io/pub/v/http_status.svg?style=flat)](https://pub.dartlang.org/packages/http_status)\n[![build status](https://github.com/DartForge/http_status/actions/workflows/build.yml/badge.svg)](https://github.com/DartForge/http_status/actions/workflows/build.yml)\n[![Coverage Status](https://coveralls.io/repos/github/DartForge/http_status/badge.svg?branch=main)](https://coveralls.io/github/DartForge/http_status?branch=main)\n[![Star this Repo](https://img.shields.io/github/stars/DartForge/http_status.svg?style=flat)](https://github.com/DartForge/http_status)\n[![License: BSD](https://img.shields.io/badge/license-BSD-purple.svg)](https://opensource.org/license/bsd-3-clause/)\n\n\u003c/p\u003e\n\nConstants enumerating the HTTP status codes in Dart. All status codes defined in RFC1945 (HTTP/1.0, RFC2616 (HTTP/1.1), and RFC2518 (WebDAV) are supported.\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ch2\u003eCodes of Http Status \u003c/h2\u003e\u003c/summary\u003e\n\n| Code | Http Status Name                   | Http Status (v1.x - v2.x Deprecated)                                                            | Http Status (v2.x - v3.x)       |\n| ---- | ---------------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------- |\n| 100  | Continue                           | Continue                                  / CONTINUE                                            | continue_                       |\n| 101  | Switching Protocols                | Switching_Protocols                       / SWITCHING_PROTOCOLS                                 | switchingProtocols              |\n| 102  | Processing                         | Processing                                / PROCESSING                                          | processing                      |\n| 103  | Early Hints                        | -                                                                                               | earlyHints                      |\n| 200  | OK                                 | Ok                                        / OK                                                  | ok                              |\n| 201  | Created                            | Created                                   / CREATED                                             | created                         |\n| 202  | Accepted                           | Accepted                                  / ACCEPTED                                            | accepted                        |\n| 203  | Non Authoritative Information      | NonAuthoritative_Information              / NON_AUTHORITATIVE_INFORMATION                       | nonAuthoritativeInformation     |\n| 204  | No Content                         | No_Content                                / NO_CONTENT                                          | noContent                       |\n| 205  | Reset Content                      | Reset_Content                             / RESET_CONTENT                                       | resetContent                    |\n| 206  | Partial Content                    | Partial_Content                           / PARTIAL_CONTENT                                     | partialContent                  |\n| 207  | Multi-Status                       | MultiStatus                               / MULTISTATUS                                         | multiStatus                     |\n| 208  | Already Reported                   | Already_Reported                          / ALREADY_REPORTED                                    | alreadyReported                 |\n| 226  | I'M Used                           | IM_Used                                   / IM_USED                                             | imUsed                          |\n| 300  | Multiple Choices                   | Multiple_Choices                          / MULTIPLE_CHOICES                                    | multipleChoices                 |\n| 301  | Moved Permanently                  | Moved_Permanently                         / MOVED_PERMANENTLY                                   | movedPermanently                |\n| 302  | Found  /  Moved Temporarily        | Found  /  Moved_Temporarily               / FOUND  /  MOVED_TEMPORARILY                         | found  /  movedTemporarily      |\n| 303  | See Other                          | See_Other                                 / SEE_OTHER                                           | seeOther                        |\n| 304  | Not Modified                       | Not_Modified                              / NOT_MODIFIED                                        | notModified                     |\n| 305  | Use Proxy                          | Use_Proxy                                 / USE_PROXY                                           | useProxy                        |\n| 307  | Temporary Redirect                 | Temporary_Redirect                        / TEMPORARY_REDIRECT                                  | temporaryRedirect               |\n| 308  | Permanent Redirect                 | Permanent_Redirect                        / PERMANENT_REDIRECT                                  | permanentRedirect               |\n| 400  | Bad Request                        | Bad_Request                               / BAD_REQUEST                                         | badRequest                      |\n| 401  | Unauthorized                       | Unauthorized                              / UNAUTHORIZED                                        | unauthorized                    |\n| 402  | Payment Required                   | Payment_Required                          / PAYMENT_REQUIRED                                    | paymentRequired                 |\n| 403  | Forbidden                          | Forbidden                                 / FORBIDDEN                                           | forbidden                       |\n| 404  | Not Found                          | Not_Found                                 / NOT_FOUND                                           | notFound                        |\n| 405  | Method Not Allowed                 | Method_Not_Allowed                        / METHOD_NOT_ALLOWED                                  | methodNotAllowed                |\n| 406  | Not Acceptable                     | Not_Acceptable                            / NOT_ACCEPTABLE                                      | notAcceptable                   |\n| 407  | Proxy Authentication Required      | Proxy_Authentication_Required             / PROXY_AUTHENTICATION_REQUIRED                       | proxyAuthenticationRequired     |\n| 408  | Request Timeout                    | Request_Timeout                           / REQUEST_TIMEOUT                                     | requestTimeout                  |\n| 409  | Conflict                           | Conflict                                  / CONFLICT                                            | conflict                        |\n| 410  | Gone                               | Gone                                      / GONE                                                | gone                            |\n| 411  | Length Required                    | Length_Required                           / LENGTH_REQUIRED                                     | lengthRequired                  |\n| 412  | Precondition Failed                | Precondition_Failed                       / PRECONDITION_FAILED                                 | preconditionFailed              |\n| 413  | Request Entity Too Large           | Payload_Too_Large / PAYLOAD_TOO_LARGE     / Request_Entity_Too_Large / REQUEST_ENTITY_TOO_LARGE | requestEntityTooLarge           |\n| 414  | Request-URI Too Long               | RequestURI_Too_Long / REQUESTURI_TOO_LONG / Request_Uri_Too_Long / REQUEST_URI_TOO_LONG         | requestUriTooLong               |\n| 415  | Unsupported Media Type             | Unsupported_Media_Type                    / UNSUPPORTED_MEDIA_TYPE                              | unsupportedMediaType            |\n| 416  | Requested Range Not Satisfiable    | Requested_Range_Not_Satisfiable           / REQUESTED_RANGE_NOT_SATISFIABLE                     | requestedRangeNotSatisfiable    |\n| 417  | Expectation Failed                 | Expectation_Failed                        / EXPECTATION_FAILED                                  | expectationFailed               |\n| 418  | I'm a teapot                       | -                                                                                               | imATeapot                       |\n| 419  | Insufficient Space on Resource     | -                                                                                               | insufficientSpaceOnResource     |\n| 420  | Method Failure                     | -                                                                                               | methodFailure                   |\n| 421  | Misdirected Request                | Misdirected_Request                       / MISDIRECTED_REQUEST                                 | misdirectedRequest              |\n| 422  | Unprocessable Entity               | Unprocessable_Entity                      / UNPROCESSABLE_ENTITY                                | unprocessableEntity             |\n| 423  | Locked                             | Locked                                    / LOCKED                                              | locked                          |\n| 424  | Failed Dependency                  | Failed_Dependency                         / FAILED_DEPENDENCY                                   | failedDependency                |\n| 426  | Upgrade Required                   | Upgrade_Required                          / UPGRADE_REQUIRED                                    | upgradeRequired                 |\n| 428  | Precondition Required              | Precondition_Required                     / PRECONDITION_REQUIRED                               | preconditionRequired            |\n| 429  | Too Many Requests                  | Too_Many_Requests                         / TOO_MANY_REQUESTS                                   | tooManyRequests                 |\n| 431  | Request Header Fields Too Large    | Request_Header_Fields_Too_Large           / REQUEST_HEADER_FIELDS_TOO_LARGE                     | requestHeaderFieldsTooLarge     |\n| 444  | Connection Closed Without Response | Connection_Closed_Without_Response        / CONNECTION_CLOSED_WITHOUT_RESPONSE                  | connectionClosedWithoutResponse |\n| 451  | Unavailable For Legal Reasons      | Unavailable_For_Legal_Reasons             / UNAVAILABLE_FOR_LEGAL_REASONS                       | unavailableForLegalReasons      |\n| 499  | Client Closed Request              | Client_Closed_Request                     / CLIENT_CLOSED_REQUEST                               | clientClosedRequest             |\n| 500  | Internal Server Error              | Internal_Server_Error                     / INTERNAL_SERVER_ERROR                               | internalServerError             |\n| 501  | Not Implemented                    | Not_Implemented                           / NOT_IMPLEMENTED                                     | notImplemented                  |\n| 502  | Bad Gateway                        | Bad_Gateway                               / BAD_GATEWAY                                         | badGateway                      |\n| 503  | Service Unavailable                | Service_Unavailable                       / SERVICE_UNAVAILABLE                                 | serviceUnavailable              |\n| 504  | Gateway Timeout                    | Gateway_Timeout                           / GATEWAY_TIMEOUT                                     | gatewayTimeout                  |\n| 505  | HTTP Version Not Supported         | HTTP_Version_Not_Supported                / HTTP_VERSION_NOT_SUPPORTED                          | httpVersionNotSupported         |\n| 506  | Variant Also Negotiates            | Variant_Also_Negotiates                   / VARIANT_ALSO_NEGOTIATES                             | variantAlsoNegotiates           |\n| 507  | Insufficient Storage               | Insufficient_Storage                      / INSUFFICIENT_STORAGE                                | insufficientStorage             |\n| 508  | Loop Detected                      | Loop_Detected                             / LOOP_DETECTED                                       | loopDetected                    |\n| 510  | Not Extended                       | Not_Extended                              / NOT_EXTENDED                                        | notExtended                     |\n| 511  | Network Authentication Required    | Network_Authentication_Required           / NETWORK_AUTHENTICATION_REQUIRED                     | networkAuthenticationRequired   |\n| 599  | Network Connect Timeout Error      | Network_Connect_Timeout_Error             / NETWORK_CONNECT_TIMEOUT_ERROR                       | networkConnectTimeoutError      |\n\nA library for debugging and displaying http status codes.\nIncludes 63 status codes, messages and desciptions sourced from\nthe official spec \u003chttps://tools.ietf.org/html/rfc723\u003e and \u003chttps://developer.mozilla.org/en-US/docs/Web/HTTP/Status/\u003e\n\n\u003c/details\u003e\n\n## Installation\n\n```shell\ndart pub add http_status\n# or\nflutter pub add http_status\n```\n\nOr in the `dependencies:` section of your `pubspec.yaml`, add the following line:\n\n```yaml\ndependencies:\n  http_status: \u003clatest_version\u003e\n```\n\n## Usage\n\nA simple usage example:\n\n```dart\nimport 'package:http_status/http_status.dart';\n\nmain() {\n  print('${HttpStatusCode.ok}');\n  // 200\n\n  print('${HttpStatus.ok}');\n  // HttpStatus(\n  //   code: 200,\n  //   name: 'OK',\n  //   description: 'The request was fulfilled.'\n  // )\n\n  print('${HttpStatusCode.noContent}');\n  // 204\n\n  print('${HttpStatus.fromCode(404)}');\n  // HttpStatus(\n  //   code: 404,\n  //   name: 'Not Found',\n  //   description: 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'\n  // )\n\n  // isInformation (Http Status Code 200 - 299)\n  print(HttpStatusCode.processing.isInformationHttpStatusCode); // true\n  print(HttpStatusCode.notFound.isInformationHttpStatusCode); // false\n  print(HttpStatus.fromCode(103).isInformationHttpStatusCode); // true\n  print(HttpStatus.fromCode(404).isInformationHttpStatusCode); // false\n  print(103.isInformationHttpStatusCode); // true\n  print(400.isInformationHttpStatusCode); // false\n\n  // isSuccessful (Http Status Code 200 - 299)\n  print(HttpStatusCode.accepted.isSuccessfulHttpStatusCode); // true\n  print(HttpStatusCode.notFound.isSuccessfulHttpStatusCode); // false\n  print(HttpStatus.fromCode(200).isSuccessfulHttpStatusCode); // true\n  print(HttpStatus.fromCode(404).isSuccessfulHttpStatusCode); // false\n  print(200.isSuccessfulHttpStatusCode); // true\n  print(400.isSuccessfulHttpStatusCode); // false\n\n  // isRedirect (Http Status Code 300 - 399)\n  print(HttpStatusCode.permanentRedirect.isRedirectHttpStatusCode); // true\n  print(HttpStatusCode.notFound.isRedirectHttpStatusCode); // false\n  print(HttpStatus.fromCode(303).isRedirectHttpStatusCode); // true\n  print(HttpStatus.fromCode(404).isRedirectHttpStatusCode); // false\n  print(303.isRedirectHttpStatusCode); // true\n  print(400.isRedirectHttpStatusCode); // false\n\n  // isClientError (Http Status Code 400 - 499)\n  print(HttpStatusCode.notFound.isClientErrorHttpStatusCode); // true\n  print(HttpStatusCode.processing.isClientErrorHttpStatusCode); // false\n  print(HttpStatus.fromCode(404).isClientErrorHttpStatusCode); // true\n  print(HttpStatus.fromCode(500).isClientErrorHttpStatusCode); // false\n  print(404.isClientErrorHttpStatusCode); // true\n  print(200.isClientErrorHttpStatusCode); // false\n\n  // isServerError (Http Status Code 500 - 599)\n  print(HttpStatusCode.internalServerError.isServerErrorHttpStatusCode); // true\n  print(HttpStatusCode.notFound.isServerErrorHttpStatusCode); // false;\n  print(HttpStatus.fromCode(502).isServerErrorHttpStatusCode); // true\n  print(HttpStatus.fromCode(200).isServerErrorHttpStatusCode); // false\n  print(503.isServerErrorHttpStatusCode); // true\n  print(200.isServerErrorHttpStatusCode); // false\n}\n```\n\n1. Classic method\n\n   ```dart\n   import 'package:http/http.dart' as http;\n   import 'package:http_status/http_status.dart';\n\n   final res = await http.get(Uri.parse(url));\n\n   if (res.statusCode == HttpStatusCode.ok) { // res.statusCode == 200\n     final httpStatus = HttpStatus.fromCode(res.statusCode);\n\n     return {\n       'statusCode': res.statusCode,\n       'httpStatus': httpStatus,\n       'data': res.body\n     };\n   }\n   ```\n\n2. Alternative method (Same as #1 method, but with more direct validation using `.isSuccessfulHttpStatusCode`)\n\n   ```dart\n   import 'package:http/http.dart' as http;\n   import 'package:http_status/http_status.dart';\n\n   final res = await http.get(Uri.parse(url));\n\n   if (res.statusCode.isSuccessfulHttpStatusCode) {\n     final httpStatus = HttpStatus.fromCode(res.statusCode);\n\n     return {\n       'statusCode': res.statusCode,\n       'httpStatus': httpStatus,\n       'data': res.body\n     };\n   }\n   ```\n\n3. Alternative method (Same as #1 method, if you need the HttpStatus object from the dynamically generated status code of the response)\n\n   ```dart\n   import 'package:http/http.dart' as http;\n   import 'package:http_status/http_status.dart';\n\n   final res = await http.get(Uri.parse(url));\n\n   final httpStatusResponse = HttpStatus.fromCode(res.statusCode);\n\n   if (httpStatusResponse.isSuccessfulHttpStatusCode) {\n     return {\n       'statusCode': res.statusCode,\n       'httpStatus': httpStatusResponse,\n       'data': res.body\n     };\n   } else if (httpStatusResponse.isClientErrorHttpStatusCode) {\n      // Handle client error\n      // ...\n   } else {\n      // Handle other code error\n      // ...\n   }\n   ```\n\n## Thanking all Awesome Contributors :heart:\n\n[![Contributors](https://contrib.rocks/image?repo=DartForge/http_status)](https://github.com/DartForge/http_status/graphs/contributors)\n\nContributions of any kind are welcome!\n\n## License\n\n[BSD](LICENSE)\n\n## Features and bugs\n\nPlease file feature requests and bugs at the [issue tracker][tracker].\n\n[tracker]: https://github.com/DartForge/http_status/issues\n","funding_links":[],"categories":["Dart"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDartForge%2Fhttp_status","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDartForge%2Fhttp_status","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDartForge%2Fhttp_status/lists"}