openwhisk-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Allen <>
Subject Issue 2674: Default handling for HTTP web actions
Date Wed, 30 Aug 2017 16:05:14 GMT
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.



[1]: <>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message