-
Notifications
You must be signed in to change notification settings - Fork 48
Open
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?
Metadata
Metadata
Assignees
Labels
No labels