You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by du...@apache.org on 2018/03/19 20:07:30 UTC

[incubator-openwhisk-package-cloudant] branch master updated: validate that query_params is valid JSON (#163)

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

dubeejw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-cloudant.git


The following commit(s) were added to refs/heads/master by this push:
     new bdb34a7  validate that query_params is valid JSON (#163)
bdb34a7 is described below

commit bdb34a755d2f9d40389850a31e62a402a8a2cd66
Author: Jason Peterson <ja...@us.ibm.com>
AuthorDate: Mon Mar 19 16:07:28 2018 -0400

    validate that query_params is valid JSON (#163)
---
 actions/changesWebAction.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/actions/changesWebAction.js b/actions/changesWebAction.js
index 3f02994..73b24ac 100644
--- a/actions/changesWebAction.js
+++ b/actions/changesWebAction.js
@@ -48,6 +48,9 @@ function main(params) {
                 catch (e) {
                     return sendError(400, 'The query_params parameter cannot be parsed. Ensure it is valid JSON.');
                 }
+                if (typeof query_params !== 'object') {
+                    return sendError(400, 'The query_params parameter is not valid JSON');
+                }
             }
         }
         else if (params.query_params) {
@@ -169,6 +172,9 @@ function main(params) {
                                 catch (e) {
                                     reject(sendError(400, 'The query_params parameter cannot be parsed. Ensure it is valid JSON.'));
                                 }
+                                if (typeof updatedParams.query_params !== 'object') {
+                                    reject(sendError(400, 'The query_params parameter is not valid JSON'));
+                                }
                             }
                         } else {
                             reject(sendError(400, 'The query_params parameter is only allowed if the filter parameter is defined'));

-- 
To stop receiving notification emails like this one, please contact
dubeejw@apache.org.