Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# go-utils

<a name="v1.39.6"></a>
## [v1.39.6] - 2025-01-17
### Fixes
- change IsURLReachable status code rule


<a name="v1.39.5"></a>
## [v1.39.5] - 2024-12-19
### Fixes
Expand Down Expand Up @@ -174,9 +180,6 @@

<a name="v1.20.0"></a>
## [v1.20.0] - 2022-03-11

<a name="v.1.20.0"></a>
## [v.1.20.0] - 2022-03-11
### New Features
- add constraint size gql directive ([#30](https://github.com/kumparan/go-utils/issues/30))

Expand Down Expand Up @@ -274,11 +277,11 @@
- add money formatter for multiple currencies ([#13](https://github.com/kumparan/go-utils/issues/13))


<a name="v1.7.1"></a>
## [v1.7.1] - 2020-12-10

<a name="v1.8.0"></a>
## [v1.8.0] - 2020-12-10

<a name="v1.7.1"></a>
## [v1.7.1] - 2020-12-10
### New Features
- add formatter for indonesian money and date

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion url.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 7 additions & 0 deletions url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Loading