You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/03/08 01:25:45 UTC

[GitHub] [cloudstack] nvazquez commented on a change in pull request #5009: api: Warn if query parameters have multiple values

nvazquez commented on a change in pull request #5009:
URL: https://github.com/apache/cloudstack/pull/5009#discussion_r821243508



##########
File path: server/src/main/java/com/cloud/api/ApiServlet.java
##########
@@ -136,6 +136,16 @@ public void run() {
         });
     }
 
+    private void ensureSingleQueryParameterValue(Map<String, String[]> params) {

Review comment:
       Can we rename this method since we are not ensuring, but simply warning about it?

##########
File path: server/src/main/java/com/cloud/api/ApiServlet.java
##########
@@ -136,6 +136,16 @@ public void run() {
         });
     }
 
+    private void ensureSingleQueryParameterValue(Map<String, String[]> params) {
+        params.forEach((k, v) -> {
+            if (v.length > 1) {
+                String message = String.format("Query parameter '%s' has multiple values %s", k, Arrays.toString(v));
+                s_logger.warn(message);

Review comment:
       Should we also advise passing a single value per parameter on both messages?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org