Skip to content

Commit

Permalink
Introduced singleton variable to reuse.
Browse files Browse the repository at this point in the history
  • Loading branch information
joliver committed Sep 21, 2024
1 parent 7582a15 commit 75a5a6c
Showing 1 changed file with 24 additions and 28 deletions.
52 changes: 24 additions & 28 deletions contracts_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,20 @@ var (
},
},
}
deserializationResultFactory = func() ResultContainer {
return &fixedResultContainer{
ResultContainer: &SerializeResult{
StatusCode: http.StatusBadRequest,
Content: InputErrors{
Errors: []error{
InputError{
Fields: []string{"body"},
Name: "malformed-request-payload",
Message: "The body did not contain well-formed data and could not be properly deserialized.",
},
},
deserializationResultFactory = func() ResultContainer { return deserializationResult }
deserializationResult = &fixedResultContainer{ResultContainer: &SerializeResult{
StatusCode: http.StatusBadRequest,
Content: InputErrors{
Errors: []error{
InputError{
Fields: []string{"body"},
Name: "malformed-request-payload",
Message: "The body did not contain well-formed data and could not be properly deserialized.",
},
},
}
}
},
}}

parseFormedFailedResult = &SerializeResult{
StatusCode: http.StatusBadRequest,
Content: InputErrors{
Expand All @@ -196,22 +194,20 @@ var (
},
},
}
bindErrorResultFactory = func() ResultContainer {
return &bindErrorContainer{
SerializeResult: &SerializeResult{
StatusCode: http.StatusBadRequest,
Content: &InputErrors{},
},
}
bindErrorResultFactory = func() ResultContainer { return bindErrorResult }
bindErrorResult = &bindErrorContainer{
SerializeResult: &SerializeResult{
StatusCode: http.StatusBadRequest,
Content: &InputErrors{},
},
}

validationResultFactory = func() ResultContainer {
return &validationErrorContainer{
SerializeResult: &SerializeResult{
StatusCode: http.StatusUnprocessableEntity,
Content: &InputErrors{},
},
}
validationResultFactory = func() ResultContainer { return validationResult }
validationResult = &validationErrorContainer{
SerializeResult: &SerializeResult{
StatusCode: http.StatusUnprocessableEntity,
Content: &InputErrors{},
},
}
)

Expand Down

0 comments on commit 75a5a6c

Please sign in to comment.