Hi all

Rodric, Carlos and myself had a discussion this afternoon about what should 
happen when the implements an HTTP web action that doesn't provide all the 
details required for sending a fully formed HTTP message back the client.

As a refresher, when implementing an HTTP web action, you need to return three 
top level keys: statusCode, headers and body, for example:

        return {
                statusCode: 201,
                headers: { "Content-Type": "application/xml" },
                body: "<xml>Created</xml>"
        }

There is also some magic for application/json where you can send back a JSON 
dictionary as the body and OpenWhisk will handle it for you:

        return {
                statusCode: 201,
                headers: { "Content-Type": "application/json" },
                body: { "foo" : { "bar" : "baz" } }
        }


Questions arise as to what to do if some of this is missing. e.g.

        return {
                body: "hello"
        }


Clearly to send a result back to the client, OpenWhisk needs to provide a 
status code and set a content type. What should it do? 

Issue [2674] [1] contains a suggestion of what we think it should do. If you're 
interested, now is a good time to comment.


Regards,

Rob...


[1]: https://github.com/apache/incubator-openwhisk/issues/2674 
<https://github.com/apache/incubator-openwhisk/issues/2674>


Reply via email to