From f270756b3fba62892067d14af32846928b009999 Mon Sep 17 00:00:00 2001 From: Andres Garcia Date: Sat, 10 Feb 2024 09:26:43 -0500 Subject: [PATCH 1/4] Refactor HTTP status code extension for better clarity and consistency - Renamed `int_extension.dart` to `int_http_status_code_extension.dart` - Updated import statements in `src.dart` to reflect the new file name --- lib/src/src.dart | 2 +- .../{int_extension.dart => int_http_status_code_extension.dart} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename lib/src/utils/{int_extension.dart => int_http_status_code_extension.dart} (100%) diff --git a/lib/src/src.dart b/lib/src/src.dart index 4896410..0cf6b01 100644 --- a/lib/src/src.dart +++ b/lib/src/src.dart @@ -1,3 +1,3 @@ export 'http_status.dart'; export 'http_status_code.dart'; -export 'utils/int_extension.dart'; +export 'utils/int_http_status_code_extension.dart'; diff --git a/lib/src/utils/int_extension.dart b/lib/src/utils/int_http_status_code_extension.dart similarity index 100% rename from lib/src/utils/int_extension.dart rename to lib/src/utils/int_http_status_code_extension.dart From fdb93984cce55f0335c261df4e30af10be82fb92 Mon Sep 17 00:00:00 2001 From: Andres Garcia Date: Sat, 10 Feb 2024 09:27:01 -0500 Subject: [PATCH 2/4] Refactor `operator ==` method in `HttpStatus` class The `operator ==` method in the `HttpStatus` class has been refactored to use the `covariant` keyword. This change improves type safety and ensures that the comparison is done correctly. The new implementation checks if the objects are identical or have the same runtime type and code. Additionally, the `toString()` method has been updated to provide a more detailed representation of an instance of `HttpStatus`. It now includes the code, name, and description properties. --- lib/src/http_status.dart | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/src/http_status.dart b/lib/src/http_status.dart index 67debbc..f853c85 100644 --- a/lib/src/http_status.dart +++ b/lib/src/http_status.dart @@ -3162,12 +3162,16 @@ class HttpStatus { int get hashCode => code.hashCode; @override - bool operator ==(Object other) => + bool operator ==(covariant HttpStatus other) => identical(this, other) || - other is HttpStatus && - runtimeType == other.runtimeType && - code == other.code; + runtimeType == other.runtimeType && code == other.code; @override - String toString() => 'HttpStatus{code: $code, name: $name}'; + String toString() => ''' +HttpStatus( + code: $code, + name: '$name', + description: '$description' +) +'''; } From b483922579db48f197b5bae885a78d21e23b674b Mon Sep 17 00:00:00 2001 From: Andres Garcia Date: Sat, 10 Feb 2024 09:41:54 -0500 Subject: [PATCH 3/4] chore: bumped version from 2.0.0 to 2.0.1. --- CHANGELOG.md | 5 +++++ pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b427b01..b798168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [2.0.1] - 2024-02-10 + +- **Enhanced comparability:** `operator ==` now uses `covariant` for better type safety and comparison accuracy. +- **Richer object representation:** `toString()` includes code, name, and description for easier debugging. + ## [2.0.0] - 2024-02-06 ### Added diff --git a/pubspec.yaml b/pubspec.yaml index 041cef3..698aaff 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: http_status 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. -version: 2.0.0 +version: 2.0.1 repository: https://github.com/andgar2010/http_status issue_tracker: https://github.com/andgar2010/http_status/issues homepage: https://github.com/andgar2010/http_status From 1404ae1f72a77c4508b585f3b41a233d95ccaa99 Mon Sep 17 00:00:00 2001 From: Andres Garcia Date: Tue, 13 Feb 2024 15:03:16 -0500 Subject: [PATCH 4/4] chore: fix url updated repo --- README.md | 12 ++++++------ pubspec.yaml | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e3a1806..92a947c 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ 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. -[![Star this Repo](https://img.shields.io/github/stars/andgar2010/http_status.svg?style=flat)](https://github.com/andgar2010/http_status) +[![Star this Repo](https://img.shields.io/github/stars/DartForge/http_status.svg?style=flat)](https://github.com/DartForge/http_status) -[![build status](https://github.com/andgar2010/http_status/actions/workflows/build.yml/badge.svg)](https://github.com/andgar2010/http_status/actions/workflows/build.yml) +[![build status](https://github.com/DartForge/http_status/actions/workflows/build.yml/badge.svg)](https://github.com/DartForge/http_status/actions/workflows/build.yml) -[![Coverage Status](https://coveralls.io/repos/github/andgar2010/http_status/badge.svg?branch=main)](https://coveralls.io/github/andgar2010/http_status?branch=main) +[![Coverage Status](https://coveralls.io/repos/github/DartForge/http_status/badge.svg?branch=main)](https://coveralls.io/github/DartForge/http_status?branch=main) [![wakatime](https://wakatime.com/badge/user/7267c60f-69d6-47f2-941f-06869f08edc8/project/018d207e-c2bf-4b0f-96f5-77f9647157f8.svg)](https://wakatime.com/badge/user/7267c60f-69d6-47f2-941f-06869f08edc8/project/018d207e-c2bf-4b0f-96f5-77f9647157f8) @@ -30,7 +30,7 @@ Constants enumerating the HTTP status codes in Dart. All status codes defined in | 226 | I'M Used | IM_Used / IM_USED | imUsed | | 300 | Multiple Choices | Multiple_Choices / MULTIPLE_CHOICES | multipleChoices | | 301 | Moved Permanently | Moved_Permanently / MOVED_PERMANENTLY | movedPermanently | -| 302 | Found / Moved Temporarily | Found / Moved_Temporarily / FOUND / MOVED_TEMPORARILY | found / movedTemporarily | +| 302 | Found / Moved Temporarily | Found / Moved_Temporarily / FOUND / MOVED_TEMPORARILY | found / movedTemporarily | | 303 | See Other | See_Other / SEE_OTHER | seeOther | | 304 | Not Modified | Not_Modified / NOT_MODIFIED | notModified | | 305 | Use Proxy | Use_Proxy / USE_PROXY | useProxy | @@ -206,7 +206,7 @@ if (res.statusCode.isSuccessfulHttpStatusCode) { ## Thanking all Awesome Contributors :heart: -[![Contributors](https://contrib.rocks/image?repo=andgar2010/http_status)](https://github.com/andgar2010/http_status/graphs/contributors) +[![Contributors](https://contrib.rocks/image?repo=DartForge/http_status)](https://github.com/DartForge/http_status/graphs/contributors) Contributions of any kind are welcome! @@ -218,4 +218,4 @@ Contributions of any kind are welcome! Please file feature requests and bugs at the [issue tracker][tracker]. -[tracker]: https://github.com/andgar2010/http_status/issues +[tracker]: https://github.com/DartForge/http_status/issues diff --git a/pubspec.yaml b/pubspec.yaml index 698aaff..4692441 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,10 +1,10 @@ name: http_status 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. version: 2.0.1 -repository: https://github.com/andgar2010/http_status -issue_tracker: https://github.com/andgar2010/http_status/issues -homepage: https://github.com/andgar2010/http_status -documentation: https://github.com/andgar2010/http_status +repository: https://github.com/DartForge/http_status +issue_tracker: https://github.com/DartForge/http_status/issues +homepage: https://github.com/DartForge/http_status +documentation: https://github.com/DartForge/http_status topics: [http_status] # author: # - Andrea Cantafio