Skip to content

Commit

Permalink
Fix missing returns in BaseHandler.Bind* methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mansam committed Sep 19, 2023
1 parent 75172b5 commit 2135b7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ type Application struct {
Comments string `json:"comments"`
Identities []Ref `json:"identities"`
Tags []TagRef `json:"tags"`
BusinessService *Ref `json:"businessService" yaml:"businessService"`
BusinessService *Ref `json:"businessService"`
Owner *Ref `json:"owner"`
Contributors []Ref `json:"contributors"`
MigrationWave *Ref `json:"migrationWave"`
Expand Down
2 changes: 2 additions & 0 deletions api/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ func (h *BaseHandler) Bind(ctx *gin.Context, r interface{}) (err error) {
func (h *BaseHandler) BindJSON(ctx *gin.Context, r interface{}) (err error) {
if ctx.Request == nil || ctx.Request.Body == nil {
err = errors.New("invalid request")
return
}
decoder := json.NewDecoder(ctx.Request.Body)
decoder.DisallowUnknownFields()
Expand All @@ -204,6 +205,7 @@ func (h *BaseHandler) BindJSON(ctx *gin.Context, r interface{}) (err error) {
func (h *BaseHandler) BindYAML(ctx *gin.Context, r interface{}) (err error) {
if ctx.Request == nil || ctx.Request.Body == nil {
err = errors.New("invalid request")
return
}
decoder := yaml.NewDecoder(ctx.Request.Body)
decoder.SetStrict(true)
Expand Down

0 comments on commit 2135b7a

Please sign in to comment.