Accept simpler response from OPA (#7637)

This commit is contained in:
Krishna Srinivas 2019-05-12 06:10:49 -07:00 committed by Nitish Tiwari
parent 3eb7a8bde8
commit 502456db91

View File

@ -123,14 +123,12 @@ func (o *Opa) IsAllowed(args Args) bool {
// Handle OPA response
type opaResponse struct {
Result struct {
Allow bool `json:"allow"`
} `json:"result"`
Allow bool `json:"allow"`
}
var result opaResponse
if err = json.NewDecoder(resp.Body).Decode(&result); err != nil {
return false
}
return result.Result.Allow
return result.Allow
}