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 // Handle OPA response
type opaResponse struct { type opaResponse struct {
Result struct { Allow bool `json:"allow"`
Allow bool `json:"allow"`
} `json:"result"`
} }
var result opaResponse var result opaResponse
if err = json.NewDecoder(resp.Body).Decode(&result); err != nil { if err = json.NewDecoder(resp.Body).Decode(&result); err != nil {
return false return false
} }
return result.Result.Allow return result.Allow
} }