Skip to content

Commit

Permalink
Fixed tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rimashah25 committed Aug 22, 2023
1 parent 4dc2fe6 commit 3dde8bc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions traffic_ops/traffic_ops_golang/profile/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ func Read(w http.ResponseWriter, r *http.Request) {
where, orderBy, pagination, queryValues, errs := dbhelpers.BuildWhereAndOrderByAndPagination(inf.Params, queryParamsToQueryCols)
if len(errs) > 0 {
api.HandleErr(w, r, tx.Tx, http.StatusBadRequest, util.JoinErrs(errs), nil)
return
}

if inf.Config.UseIMS {
Expand Down Expand Up @@ -454,7 +455,7 @@ func Read(w http.ResponseWriter, r *http.Request) {
for _, p := range profileList {
// Attach Parameters if the 'param' parameter is sent
if _, ok := inf.Params["param"]; ok {
profile.Parameters, err = ReadParameters(inf.Tx, inf.User, &p.ID)
p.Parameters, err = ReadParameters(inf.Tx, inf.User, &p.ID)
if err != nil {
api.HandleErr(w, r, tx.Tx, http.StatusInternalServerError, nil, fmt.Errorf("profile read: error reading parameters for a profile: %w", err))
return
Expand Down Expand Up @@ -662,7 +663,7 @@ func readAndValidateJsonStruct(r *http.Request) (tc.ProfileV5, error) {
// validate JSON body
errs := tovalidate.ToErrors(validation.Errors{
"name": validation.Validate(profile.Name, validation.Required, rule),
"cdn": validation.Validate(profile.CDNID, validation.NotNil),
"cdn": validation.Validate(profile.CDNID, validation.NilOrNotEmpty),
"type": validation.Validate(profile.Type, validation.Required, validation.NotNil),
"routingDisabled": validation.Validate(profile.RoutingDisabled, validation.NotNil),
"description": validation.Validate(profile.Description, validation.Required),
Expand Down

0 comments on commit 3dde8bc

Please sign in to comment.