Update IAM access manager plugin demo (#19007)

Now prints the JSON payload for easier debugging.
This commit is contained in:
Aditya Manthramurthy 2024-02-08 09:15:20 -08:00 committed by GitHub
parent e104b183d8
commit a29c66ed74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,7 @@
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
@ -58,6 +59,10 @@ func mainHandler(w http.ResponseWriter, r *http.Request) {
return
}
var out bytes.Buffer
json.Indent(&out, body, "", " ")
fmt.Printf("Received JSON payload:\n%s\n", out.String())
reqMap := make(map[string]interface{})
err = json.Unmarshal(body, &reqMap)
if err != nil {
@ -65,8 +70,6 @@ func mainHandler(w http.ResponseWriter, r *http.Request) {
return
}
// fmt.Printf("request: %#v\n", reqMap)
m := reqMap["input"].(map[string]interface{})
accountValue := m["account"].(string)
actionValue := m["action"].(string)