apache / apache/openwhisk-runtime-go
Failing to write a response containing headers
- Dominant language
- Go
- Stars
- 45
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am currently trying to create a response containing headers in openwhisk with golang.
I feel like I need a nested map with different value types. But since golang is strongly-typed that is impossible.
I tried to marshal a struct, but failed since the Main functions wants a map as return value.
My best try as response is:
```
outobj := make(map[string]interface{})
outobj["headers"] = "{\"Content-Type\": \"text/html\"}"
outobj["statusCode"] = 201
outobj["body"] = "123"
return outobj
```
But invoking that action gives an http error.
The reason for that error is the content of the "headers" key. Uncommenting it makes the action work.
Can someone provide an example how to set headers in the golang response?
Contributor guide
Assessment
This issue has not been assessed yet.