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 = 'type of __ow_body: ' . 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": "type of __ow_body: array"
   }
   
   $ curl -X POST $URL -d '{"test": "this"}'
   {
     "result": "type of __ow_body: 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:
[email protected]


With regards,
Apache Git Services

Reply via email to