@@ -310,18 +310,28 @@ func (h *httpHostEmulator) HttpFilterInitContext() (contextID uint32) {
310
310
311
311
// impl HostEmulator
312
312
func (h * httpHostEmulator ) HttpFilterPutRequestHeaders (contextID uint32 , headers [][2 ]string ) {
313
+ h .HttpFilterPutRequestHeadersEndOfStream (contextID , headers , false )
314
+ }
315
+
316
+ // impl HostEmulator
317
+ func (h * httpHostEmulator ) HttpFilterPutRequestHeadersEndOfStream (contextID uint32 , headers [][2 ]string , endOfStream bool ) {
313
318
cs , ok := h .httpStreams [contextID ]
314
319
if ! ok {
315
320
log .Fatalf ("invalid context id: %d" , contextID )
316
321
}
317
322
318
323
cs .requestHeaders = headers
319
324
cs .action = proxywasm .ProxyOnRequestHeaders (contextID ,
320
- len (headers ), false ) // TODO: allow for specifying end_of_stream
325
+ len (headers ), endOfStream )
321
326
}
322
327
323
328
// impl HostEmulator
324
329
func (h * httpHostEmulator ) HttpFilterPutResponseHeaders (contextID uint32 , headers [][2 ]string ) {
330
+ h .HttpFilterPutResponseHeadersEndOfStream (contextID , headers , false )
331
+ }
332
+
333
+ // impl HostEmulator
334
+ func (h * httpHostEmulator ) HttpFilterPutResponseHeadersEndOfStream (contextID uint32 , headers [][2 ]string , endOfStream bool ) {
325
335
cs , ok := h .httpStreams [contextID ]
326
336
if ! ok {
327
337
log .Fatalf ("invalid context id: %d" , contextID )
@@ -330,7 +340,7 @@ func (h *httpHostEmulator) HttpFilterPutResponseHeaders(contextID uint32, header
330
340
cs .responseHeaders = headers
331
341
332
342
cs .action = proxywasm .ProxyOnResponseHeaders (contextID ,
333
- len (headers ), false ) // TODO: allow for specifying end_of_stream
343
+ len (headers ), endOfStream )
334
344
}
335
345
336
346
// impl HostEmulator
@@ -357,16 +367,22 @@ func (h *httpHostEmulator) HttpFilterPutResponseTrailers(contextID uint32, heade
357
367
358
368
// impl HostEmulator
359
369
func (h * httpHostEmulator ) HttpFilterPutRequestBody (contextID uint32 , body []byte ) {
370
+ h .HttpFilterPutRequestBodyEndOfStream (contextID , body , false )
371
+ }
372
+
373
+ // impl HostEmulator
374
+ func (h * httpHostEmulator ) HttpFilterPutRequestBodyEndOfStream (contextID uint32 , body []byte , endOfStream bool ) {
360
375
cs , ok := h .httpStreams [contextID ]
361
376
if ! ok {
362
377
log .Fatalf ("invalid context id: %d" , contextID )
363
378
}
364
379
365
380
cs .requestBody = body
366
381
cs .action = proxywasm .ProxyOnRequestBody (contextID ,
367
- len (body ), false ) // TODO: allow for specifying end_of_stream
382
+ len (body ), endOfStream )
368
383
}
369
384
385
+ // impl HostEmulator
370
386
func (h * httpHostEmulator ) HttpFilterGetRequestBody (contextID uint32 ) []byte {
371
387
cs , ok := h .httpStreams [contextID ]
372
388
if ! ok {
@@ -378,16 +394,21 @@ func (h *httpHostEmulator) HttpFilterGetRequestBody(contextID uint32) []byte {
378
394
379
395
// impl HostEmulator
380
396
func (h * httpHostEmulator ) HttpFilterPutResponseBody (contextID uint32 , body []byte ) {
397
+ h .HttpFilterPutResponseBodyEndOfStream (contextID , body , false )
398
+ }
399
+
400
+ func (h * httpHostEmulator ) HttpFilterPutResponseBodyEndOfStream (contextID uint32 , body []byte , endOfStream bool ) {
381
401
cs , ok := h .httpStreams [contextID ]
382
402
if ! ok {
383
403
log .Fatalf ("invalid context id: %d" , contextID )
384
404
}
385
405
386
406
cs .responseBody = body
387
407
cs .action = proxywasm .ProxyOnResponseBody (contextID ,
388
- len (body ), false ) // TODO: allow for specifying end_of_stream
408
+ len (body ), endOfStream )
389
409
}
390
410
411
+ // impl HostEmulator
391
412
func (h * httpHostEmulator ) HttpFilterGetResponseBody (contextID uint32 ) []byte {
392
413
cs , ok := h .httpStreams [contextID ]
393
414
if ! ok {
0 commit comments