diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb4b655..f4269ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# go-utils
+
+## [v1.39.6] - 2025-01-17
+### Fixes
+- change IsURLReachable status code rule
+
+
## [v1.39.5] - 2024-12-19
### Fixes
@@ -174,9 +180,6 @@
## [v1.20.0] - 2022-03-11
-
-
-## [v.1.20.0] - 2022-03-11
### New Features
- add constraint size gql directive ([#30](https://github.com/kumparan/go-utils/issues/30))
@@ -274,11 +277,11 @@
- add money formatter for multiple currencies ([#13](https://github.com/kumparan/go-utils/issues/13))
-
-## [v1.7.1] - 2020-12-10
-
## [v1.8.0] - 2020-12-10
+
+
+## [v1.7.1] - 2020-12-10
### New Features
- add formatter for indonesian money and date
@@ -343,7 +346,8 @@
- init go-utils
-[Unreleased]: https://github.com/kumparan/go-utils/compare/v1.39.5...HEAD
+[Unreleased]: https://github.com/kumparan/go-utils/compare/v1.39.6...HEAD
+[v1.39.6]: https://github.com/kumparan/go-utils/compare/v1.39.5...v1.39.6
[v1.39.5]: https://github.com/kumparan/go-utils/compare/v1.39.4...v1.39.5
[v1.39.4]: https://github.com/kumparan/go-utils/compare/v1.39.3...v1.39.4
[v1.39.3]: https://github.com/kumparan/go-utils/compare/v1.39.2...v1.39.3
@@ -372,8 +376,7 @@
[v1.22.0]: https://github.com/kumparan/go-utils/compare/v1.21.0...v1.22.0
[v1.21.0]: https://github.com/kumparan/go-utils/compare/v1.20.1...v1.21.0
[v1.20.1]: https://github.com/kumparan/go-utils/compare/v1.20.0...v1.20.1
-[v1.20.0]: https://github.com/kumparan/go-utils/compare/v.1.20.0...v1.20.0
-[v.1.20.0]: https://github.com/kumparan/go-utils/compare/v1.19.3...v.1.20.0
+[v1.20.0]: https://github.com/kumparan/go-utils/compare/v1.19.3...v1.20.0
[v1.19.3]: https://github.com/kumparan/go-utils/compare/v1.19.2...v1.19.3
[v1.19.2]: https://github.com/kumparan/go-utils/compare/v1.19.1...v1.19.2
[v1.19.1]: https://github.com/kumparan/go-utils/compare/v1.19.0...v1.19.1
@@ -389,9 +392,9 @@
[v1.12.0]: https://github.com/kumparan/go-utils/compare/v1.11.0...v1.12.0
[v1.11.0]: https://github.com/kumparan/go-utils/compare/v1.10.0...v1.11.0
[v1.10.0]: https://github.com/kumparan/go-utils/compare/v1.9.0...v1.10.0
-[v1.9.0]: https://github.com/kumparan/go-utils/compare/v1.7.1...v1.9.0
-[v1.7.1]: https://github.com/kumparan/go-utils/compare/v1.8.0...v1.7.1
-[v1.8.0]: https://github.com/kumparan/go-utils/compare/v1.7.0...v1.8.0
+[v1.9.0]: https://github.com/kumparan/go-utils/compare/v1.8.0...v1.9.0
+[v1.8.0]: https://github.com/kumparan/go-utils/compare/v1.7.1...v1.8.0
+[v1.7.1]: https://github.com/kumparan/go-utils/compare/v1.7.0...v1.7.1
[v1.7.0]: https://github.com/kumparan/go-utils/compare/v1.6.0...v1.7.0
[v1.6.0]: https://github.com/kumparan/go-utils/compare/v1.5.0...v1.6.0
[v1.5.0]: https://github.com/kumparan/go-utils/compare/v1.4.0...v1.5.0
diff --git a/url.go b/url.go
index e595127..058e951 100644
--- a/url.go
+++ b/url.go
@@ -31,5 +31,6 @@ func IsURLReachable(url string) bool {
_ = res.Body.Close()
}()
- return res.StatusCode == http.StatusOK
+ log.Infof("statusCode: %d", res.StatusCode)
+ return res.StatusCode < 500
}
diff --git a/url_test.go b/url_test.go
index 1cc9c13..eb80e84 100644
--- a/url_test.go
+++ b/url_test.go
@@ -70,6 +70,13 @@ func Test_JoinURL(t *testing.T) {
}
func TestIsURLReachable(t *testing.T) {
+ t.Run("should return true on valid + reachable url", func(t *testing.T) {
+ url := "https://docs.google.com/spreadsheets/d/1IJ3C-U-N8OqIlk1pZoGyKadTPowiJIhWla4CQMFh9NQ/edit?gid=1131639184#gid=1131639184"
+
+ res := IsURLReachable(url)
+ assert.True(t, res)
+ })
+
t.Run("should return true on valid + reachable url", func(t *testing.T) {
url := "https://google.com"