You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/04/03 18:40:42 UTC

[GitHub] gnaryak opened a new issue #3518: OpenWhisk Webactions only accept one single query string parameter

gnaryak opened a new issue #3518: OpenWhisk Webactions only accept one single query string parameter
URL: https://github.com/apache/incubator-openwhisk/issues/3518
 
 
   <!--
   Do NOT share passwords, credentials or other confidential information.
   
   Before creating a new issue, please check if there is one already open that
   fits the defect you are reporting.
   If you open an issue and realize later it is a duplicate of a pre-existing
   open issue, please close yours and add a comment to the other.
   
   Issues can be created for either defects or enhancement requests. If you are a committer than please add the labels "bug" or "feature". If you are not a committer please make clear in the comments which one it is, so that committers can add these labels later.
   
   If you are reporting a defect, please edit the issue description to include the
   information shown below.
   
   If you are reporting an enhancement request, please include information on what you are trying to achieve and why that enhancement would help you.
   
   For more information about reporting issues, see
   https://github.com/apache/incubator-openwhisk/blob/master/CONTRIBUTING.md#raising-issues
   
   Use the commands below to provide key information from your environment:
   You do not have to include this information if this is a feature request.
   -->
   
   ## Environment details:
   
   * IBM Cloud OpenWhisk
   
   ## Steps to reproduce the issue:
   
    I have created a simple Webaction
   
   The source code is product.js:
   const main = (params) => {
       return {
           body: {
              params
           },
           statusCode:200,
           headers: {
               'Content-Type': 'application/json'
           }
       };
   };
   
   I created an OpenWhisk action (including making it a web action):
   bx wsk action create product server/product.js --web true
   
   Using the Webaction interface, i can invoke the function like this:
   curl https://openwhisk.ng.bluemix.net/api/v1/web/ag-sandbox_dev/default/product.json
   
   So far so good. I can send a query string parameter like this:
   curl https://openwhisk.ng.bluemix.net/api/v1/web/ag-sandbox_dev/default/product.json?a=b
   
   I can see in the response that the params object contains a property "a" that equals "b". Again, so far so good. Now I send a second query string parameter to the URL:
   curl https://openwhisk.ng.bluemix.net/api/v1/web/ag-sandbox_dev/default/product.json?a=b&c=d
   
   Now we see the problem. The "c": "d" block unexpectedly does NOT appear in the param section of the response. Only the first query string parameter appears in the params.
   
   ## Provide the expected results and outputs:
   
   ```
   {
     "body": {
       "params": {
         "__ow_method": "get",
         "__ow_headers": {
           "accept": "*/*",
           "user-agent": "curl/7.54.0",
           "x-client-ip": "47.208.174.104",
           "x-forwarded-proto": "https",
           "host": "openwhisk.ng.bluemix.net:443",
           "cache-control": "no-transform",
           "via": "1.1 EwAAAMnwih0-",
           "x-global-transaction-id": "2561107807",
           "x-forwarded-for": "47.208.174.104"
         },
         "__ow_path": "",
         "a": "b",
         "c": "d"
       }
     },
     "statusCode": 200,
     "headers": {
       "Content-Type": "application/json"
     }
   }
   ```
   
   
   ## Provide the actual results and outputs:
   
   ```
   {
     "body": {
       "params": {
         "__ow_method": "get",
         "__ow_headers": {
           "accept": "*/*",
           "user-agent": "curl/7.54.0",
           "x-client-ip": "47.208.174.104",
           "x-forwarded-proto": "https",
           "host": "openwhisk.ng.bluemix.net:443",
           "cache-control": "no-transform",
           "via": "1.1 EwAAAMnwih0-",
           "x-global-transaction-id": "2561107807",
           "x-forwarded-for": "47.208.174.104"
         },
         "__ow_path": "",
         "a": "b"
       }
     },
     "statusCode": 200,
     "headers": {
       "Content-Type": "application/json"
     }
   }
   ```
   Note the missing "c": "d" block.
   
   ## Additional information you deem important:
   
   I am able to successfully send multiple parameters if I send them as the request body.
   
   The inability to send more than one query string parameter seems like a bug. Right? Am I missing something?
   
   I can see the obvious workaround of sending parameters as request body content instead of query string parameters. This approach would unfortunately prevent me from exposing the clean REST API syntax I would prefer to use, obligating me to use body data when I'd prefer to use query string parameters.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services