File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed
main/java/org/extism/sdk/manifest Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 6
6
* Configures memory for the Wasm runtime.
7
7
* Memory is described in units of pages (64KB) and represent contiguous chunks of addressable memory.
8
8
*
9
- * @param max Max number of pages.
9
+ * @param maxPages Max number of pages.
10
+ * @param httpMax Max number of bytes returned by HTTP requests using extism_http_request
10
11
*/
11
12
public class MemoryOptions {
12
- @ SerializedName ("max " )
13
- private final Integer max ;
13
+ @ SerializedName ("max_pages " )
14
+ private final Integer maxPages ;
14
15
15
- public MemoryOptions (Integer max ) {
16
- this .max = max ;
16
+ @ SerializedName ("max_http_response_bytes" )
17
+ private final Integer maxHttpResponseBytes ;
18
+
19
+ public MemoryOptions (Integer maxPages , Integer httpMax ) {
20
+ this .maxPages = maxPages ;
21
+ this .maxHttpResponseBytes = httpMax ;
17
22
}
18
23
}
Original file line number Diff line number Diff line change @@ -32,13 +32,14 @@ public void shouldSerializeManifestWithWasmSourceToJson() {
32
32
@ Test
33
33
public void shouldSerializeManifestWithWasmSourceAndMemoryOptionsToJson () {
34
34
35
- var manifest = new Manifest (List .of (CODE .pathWasmSource ()), new MemoryOptions (4 ));
35
+ var manifest = new Manifest (List .of (CODE .pathWasmSource ()), new MemoryOptions (4 , 1024 * 1024 * 10 ));
36
36
var json = JsonSerde .toJson (manifest );
37
37
assertNotNull (json );
38
38
39
39
assertJson (json ).at ("/wasm" ).isArray ();
40
40
assertJson (json ).at ("/wasm" ).hasSize (1 );
41
- assertJson (json ).at ("/memory/max" ).isEqualTo (4 );
41
+ assertJson (json ).at ("/memory/max_pages" ).isEqualTo (4 );
42
+ assertJson (json ).at ("/memory/max_http_response_bytes" ).isEqualTo (1024 * 1024 * 10 );
42
43
}
43
44
44
45
@ Test
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public class PluginTests {
21
21
22
22
@ Test
23
23
public void shouldInvokeFunctionWithMemoryOptions () {
24
- var manifest = new Manifest (List .of (CODE .pathWasmSource ()), new MemoryOptions (0 ));
24
+ var manifest = new Manifest (List .of (CODE .pathWasmSource ()), new MemoryOptions (0 , 0 ));
25
25
assertThrows (ExtismException .class , () -> {
26
26
Extism .invokeFunction (manifest , "count_vowels" , "Hello World" );
27
27
});
You can’t perform that action at this time.
0 commit comments