Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add error body when returning 401 due to invalid token #213

Merged
merged 1 commit into from
Oct 17, 2023
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
4 changes: 3 additions & 1 deletion cmd/argo-watcher/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@
} else if deployToken != "" && deployToken != env.config.DeployToken {
// if token is provided, but it's not valid we should not process the task
log.Warn().Msgf("deploy token is invalid for app %s, aborting", task.App)
c.JSON(http.StatusUnauthorized, models.TaskStatus{})
c.JSON(http.StatusUnauthorized, models.TaskStatus{
Status: "invalid token",
})

Check warning on line 126 in cmd/argo-watcher/router.go

View check run for this annotation

Codecov / codecov/patch

cmd/argo-watcher/router.go#L124-L126

Added lines #L124 - L126 were not covered by tests
return
} else {
log.Debug().Msgf("deploy token is not provided for app %s", task.App)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require (
github.com/stretchr/testify v1.8.3
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0
github.com/swaggo/swag v1.16.1
go.uber.org/mock v0.2.0
gopkg.in/yaml.v2 v2.4.0
gorm.io/datatypes v1.2.0
Expand Down Expand Up @@ -78,7 +79,6 @@ require (
github.com/prometheus/procfs v0.10.1 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/skeema/knownhosts v1.2.0 // indirect
github.com/swaggo/swag v1.16.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
Expand Down
Loading