You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2018/11/06 22:14:46 UTC

[trafficcontrol] branch master updated: Fix TO Go bad params to return 400 not 5xx

This is an automated email from the ASF dual-hosted git repository.

dangogh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 855b392  Fix TO Go bad params to return 400 not 5xx
855b392 is described below

commit 855b392583d376c9fed32b3450008fe1ce5913bc
Author: Robert Butts <ro...@apache.org>
AuthorDate: Fri Nov 2 14:00:57 2018 -0600

    Fix TO Go bad params to return 400 not 5xx
---
 traffic_ops/traffic_ops_golang/api/api.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/traffic_ops/traffic_ops_golang/api/api.go b/traffic_ops/traffic_ops_golang/api/api.go
index d46df5f..26755a6 100644
--- a/traffic_ops/traffic_ops_golang/api/api.go
+++ b/traffic_ops/traffic_ops_golang/api/api.go
@@ -223,7 +223,7 @@ func StripParamJSON(params map[string]string) map[string]string {
 func AllParams(req *http.Request, required []string, ints []string) (map[string]string, map[string]int, error, error, int) {
 	params, err := GetCombinedParams(req)
 	if err != nil {
-		return nil, nil, errors.New("getting combined URI parameters: " + err.Error()), nil, http.StatusBadRequest
+		return nil, nil, nil, errors.New("getting combined URI parameters: " + err.Error()), http.StatusInternalServerError
 	}
 	params = StripParamJSON(params)
 	if err := ParamsHaveRequired(params, required); err != nil {
@@ -231,7 +231,7 @@ func AllParams(req *http.Request, required []string, ints []string) (map[string]
 	}
 	intParams, err := IntParams(params, ints)
 	if err != nil {
-		return nil, nil, nil, errors.New("getting integer parameters: " + err.Error()), http.StatusInternalServerError
+		return nil, nil, errors.New("getting integer parameters: " + err.Error()), nil, http.StatusBadRequest
 	}
 	return params, intParams, nil, nil, 0
 }