File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
services/question-service/handlers Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,11 @@ func (s *Service) ListQuestions(w http.ResponseWriter, r *http.Request) {
81
81
return
82
82
}
83
83
84
+ if len (sortFieldsParam ) > 1 || len (sortValuesParam ) > 1 {
85
+ http .Error (w , "At most 1 sortField and sortValue pair allowed" , http .StatusBadRequest )
86
+ return
87
+ }
88
+
84
89
sortedById := false
85
90
for i , sortField := range sortFieldsParam {
86
91
if ! isValidSortField [sortField ] {
@@ -108,7 +113,7 @@ func (s *Service) ListQuestions(w http.ResponseWriter, r *http.Request) {
108
113
totalIter , err := query .Documents (ctx ).GetAll ()
109
114
totalCount := len (totalIter )
110
115
if err != nil {
111
- http .Error (w , "Failed to count questions" , http .StatusInternalServerError )
116
+ http .Error (w , "Failed to count questions: " + err . Error () , http .StatusInternalServerError )
112
117
return
113
118
}
114
119
You can’t perform that action at this time.
0 commit comments