You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/08/29 14:34:06 UTC

[GitHub] [openwhisk-runtime-go] sciabarracom commented on a change in pull request #97: env support

sciabarracom commented on a change in pull request #97: env support
URL: https://github.com/apache/openwhisk-runtime-go/pull/97#discussion_r319105194
 
 

 ##########
 File path: openwhisk/initHandler_test.go
 ##########
 @@ -243,3 +244,24 @@ func Example_zip_init() {
 	// XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX
 	// XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX
 }
+
+func Example_parse_env() {
+	var request initBodyRequest
+	body := []byte(`{"code":"code"}`)
+	json.Unmarshal(body, &request)
+	fmt.Println(request.Env)
+
+	var request1 initBodyRequest
+	body = []byte(`{"code":"code", "env":{"hello":"world"}}`)
+	json.Unmarshal(body, &request1)
+	fmt.Println(request1.Env["hello"])
+
+	var request2 initBodyRequest
+	body = []byte(`{"code":"code", "env": { "hello": "world", "hi": "all"}}`)
+	json.Unmarshal(body, &request2)
+	fmt.Println(request2.Env["hello"], request2.Env["hi"])
 
 Review comment:
   In the // Output: ... I guess you are now familiar with example testing that I use everywhere...

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services