File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ type PayloadInput struct {
159159 Headers map [string ][]string `json:"headers"`
160160 JWTHeader JwtHeader `json:"tokenHeader"`
161161 JWTPayload map [string ]interface {} `json:"tokenPayload"`
162- Body map [ string ] interface {} `json:"body,omitempty"`
162+ Body interface {} `json:"body,omitempty"`
163163 Form url.Values `json:"form,omitempty"`
164164}
165165
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ func TestServeOPAWithBody(t *testing.T) {
121121 contentType string
122122 body string
123123 allowed bool
124- expectedBody map [ string ] interface {}
124+ expectedBody interface {}
125125 expectedForm url.Values
126126 expectedStatus int
127127 drainBody bool
@@ -144,6 +144,28 @@ func TestServeOPAWithBody(t *testing.T) {
144144 expectedStatus : http .StatusOK ,
145145 drainBody : true ,
146146 },
147+ {
148+ name : "jsonArray" ,
149+ method : "POST" ,
150+ contentType : "application/json" ,
151+ body : `[ "killroy", "washere" ]` ,
152+ allowed : true ,
153+ expectedBody : []interface {}{
154+ "killroy" , "washere" ,
155+ },
156+ expectedStatus : http .StatusOK ,
157+ drainBody : true ,
158+ },
159+ {
160+ name : "jsonLiteral" ,
161+ method : "POST" ,
162+ contentType : "application/json" ,
163+ body : `"killroy"` ,
164+ allowed : true ,
165+ expectedBody : "killroy" ,
166+ expectedStatus : http .StatusOK ,
167+ drainBody : true ,
168+ },
147169 {
148170 name : "nobody" ,
149171 method : "POST" ,
You can’t perform that action at this time.
0 commit comments