You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/08/17 15:00:13 UTC

[GitHub] akrabat commented on issue #2630: JSON encoding is inconsistent for web actions

akrabat commented on issue #2630: JSON encoding is inconsistent for web actions
URL: https://github.com/apache/incubator-openwhisk/issues/2630#issuecomment-323099171
 
 
   Bluemix results for comparison (only base64 encode tests):
   
   ```php
   <?php
   function main(array $args) : array
   {
       return [
           "body" =>  base64_encode(json_encode(["greeting" => "Hello world"])),
           "headers" => ["Content-Type" => "application/json-patch+json"],
       ];
   }
   ```
   gives:
   ```
   $ curl -i https://openwhisk.eu-gb.bluemix.net/api/v1/web/19FT_dev/default/hello
   HTTP/1.1 200 OK
   Content-Type: application/json-patch+json
   
   {"greeting":"Hello world"}
   ```
   
   So this works on Bluemix, but not locally.
   
   ```php
   <?php
   function main(array $args) : array
   {
       return [
           "body" => base64_encode(json_encode(["greeting" => "Hello world"])),
           "headers" => ["Content-Type" => "application/problem+json"],
       ];
   }
   ```
   gives:
   ```
   $ curl -i https://openwhisk.eu-gb.bluemix.net/api/v1/web/19FT_dev/default/hello
   HTTP/1.1 400 Bad Request
   Content-Type: application/json; charset=UTF-8
   
   {
     "error": "Response did not specify a known content-type.",
     "code": 2710626
   }
   ```
   
   Fails on both.
 
----------------------------------------------------------------
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