DonRichie commented on issue #161:
URL: 
https://github.com/apache/openwhisk-runtime-go/issues/161#issuecomment-1043713063


   **I actually managed to set a header:**
   
   ```
   package main
   
   import (
     "fmt"
     "encoding/json"
   )
   
   func PrettyPrint(v interface{}) (err error) {
         b, err := json.MarshalIndent(v, "", "  ")
         if err == nil {
                 fmt.Println(string(b))
         }
         return
   }
   
   func Main(inobj map[string]interface{}) map[string]interface{} {
     fmt.Println("inobj:")
     PrettyPrint(inobj)
     
     // set headers
     headers :=   make(map[string]interface{})
     headers["kek"] = "kok"
     headers_bin_str,err := json.Marshal(headers)
     headers_str := string(headers_bin_str)
     if err != nil {
       fmt.Println(err)
     }
   
     // assemble response
     outobj := make(map[string]interface{})
     fmt.Println(headers_str)
     header_map := make(map[string]string)
     header_map["headername"]= "headerval"
     outobj["headers"] = header_map
     outobj["statusCode"] = 201
     outobj["body"] = "123"
     fmt.Println("outobj:")
     PrettyPrint(outobj)
     return outobj
   }
   ```
   
   I hereby request to extend the documentation with a nice example.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to