File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
main/java/com/styra/opa/wasm
test/java/com/styra/opa/wasm Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,11 @@ public OpaPolicy data(JsonNode data) {
93
93
}
94
94
95
95
public OpaPolicy input (String input ) {
96
+ if (this .dataAddr == -1 ) {
97
+ // to keep the ordering: data - input - evaluate
98
+ data ("" );
99
+ }
100
+
96
101
var inputLen = input .getBytes ().length ;
97
102
var delta = this .dataHeapPtr + inputLen - (wasm .memory ().pages () * Memory .PAGE_SIZE );
98
103
if (delta > 0 ) {
Original file line number Diff line number Diff line change @@ -98,7 +98,6 @@ public void highLevelAPI() throws Exception {
98
98
@ Test
99
99
public void issue69 () throws Exception {
100
100
var policy = OpaPolicy .builder ().withPolicy (issue69WasmFile ).build ();
101
- policy .data ("" );
102
101
103
102
policy .input ("{\" method\" :\" GET\" }" );
104
103
Assertions .assertTrue (Utils .getResult (policy .evaluate ()).asBoolean ());
You can’t perform that action at this time.
0 commit comments