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/02/21 17:21:37 UTC

[GitHub] akrabat commented on issue #3321: __ow_body should always be a string (or null?)

akrabat commented on issue #3321: __ow_body should always be a string (or null?)
URL: https://github.com/apache/incubator-openwhisk/issues/3321#issuecomment-367402439
 
 
   Action: `owbody.php`
   
   ```php
   <?php declare(strict_types=1);
   
   function main(array $args) : array
   {
       if (array_key_exists('__ow_body', $args)) {
           $result = '__ow_body is a ' . gettype($args['__ow_body']);
       } else {
           $result = '__ow_body was not passed to action';
       }
   
       return [
           'body' => [
               'result' => $result,
           ]
       ];
   }
   ```
   
   commands:
   
   ```
   $ wsk action update owbody owbody.php --web raw
   ok: updated action owbody
   
   $ export URL=`wsk action get owbody --url | tail -n1`
   
   $ curl -X GET $URL
   {
     "result": "__ow_body is a array"
   }
   
   $ curl -X POST $URL -d '{"test": "this"}'
   {
     "result": "__ow_body is a string"
   }
   ```
   
   

----------------------------------------------------------------
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