@@ -82,10 +82,18 @@ pub trait Context {
82
82
hostcalls:: get_map ( MapType :: HttpCallResponseHeaders ) . unwrap ( )
83
83
}
84
84
85
+ fn get_http_call_response_headers_bytes ( & self ) -> Vec < ( String , Bytes ) > {
86
+ hostcalls:: get_map_bytes ( MapType :: HttpCallResponseHeaders ) . unwrap ( )
87
+ }
88
+
85
89
fn get_http_call_response_header ( & self , name : & str ) -> Option < String > {
86
90
hostcalls:: get_map_value ( MapType :: HttpCallResponseHeaders , & name) . unwrap ( )
87
91
}
88
92
93
+ fn get_http_call_response_header_bytes ( & self , name : & str ) -> Option < Bytes > {
94
+ hostcalls:: get_map_value_bytes ( MapType :: HttpCallResponseHeaders , name) . unwrap ( )
95
+ }
96
+
89
97
fn get_http_call_response_body ( & self , start : usize , max_size : usize ) -> Option < Bytes > {
90
98
hostcalls:: get_buffer ( BufferType :: HttpCallResponseBody , start, max_size) . unwrap ( )
91
99
}
@@ -94,10 +102,18 @@ pub trait Context {
94
102
hostcalls:: get_map ( MapType :: HttpCallResponseTrailers ) . unwrap ( )
95
103
}
96
104
105
+ fn get_http_call_response_trailers_bytes ( & self ) -> Vec < ( String , Bytes ) > {
106
+ hostcalls:: get_map_bytes ( MapType :: HttpCallResponseTrailers ) . unwrap ( )
107
+ }
108
+
97
109
fn get_http_call_response_trailer ( & self , name : & str ) -> Option < String > {
98
110
hostcalls:: get_map_value ( MapType :: HttpCallResponseTrailers , & name) . unwrap ( )
99
111
}
100
112
113
+ fn get_http_call_response_trailer_bytes ( & self , name : & str ) -> Option < Bytes > {
114
+ hostcalls:: get_map_value_bytes ( MapType :: HttpCallResponseTrailers , name) . unwrap ( )
115
+ }
116
+
101
117
fn dispatch_grpc_call (
102
118
& self ,
103
119
upstream_name : & str ,
@@ -271,22 +287,42 @@ pub trait HttpContext: Context {
271
287
hostcalls:: get_map ( MapType :: HttpRequestHeaders ) . unwrap ( )
272
288
}
273
289
290
+ fn get_http_request_headers_bytes ( & self ) -> Vec < ( String , Bytes ) > {
291
+ hostcalls:: get_map_bytes ( MapType :: HttpRequestHeaders ) . unwrap ( )
292
+ }
293
+
274
294
fn set_http_request_headers ( & self , headers : Vec < ( & str , & str ) > ) {
275
295
hostcalls:: set_map ( MapType :: HttpRequestHeaders , headers) . unwrap ( )
276
296
}
277
297
298
+ fn set_http_request_headers_bytes ( & self , headers : Vec < ( & str , & [ u8 ] ) > ) {
299
+ hostcalls:: set_map_bytes ( MapType :: HttpRequestHeaders , headers) . unwrap ( )
300
+ }
301
+
278
302
fn get_http_request_header ( & self , name : & str ) -> Option < String > {
279
303
hostcalls:: get_map_value ( MapType :: HttpRequestHeaders , & name) . unwrap ( )
280
304
}
281
305
306
+ fn get_http_request_header_bytes ( & self , name : & str ) -> Option < Bytes > {
307
+ hostcalls:: get_map_value_bytes ( MapType :: HttpRequestHeaders , name) . unwrap ( )
308
+ }
309
+
282
310
fn set_http_request_header ( & self , name : & str , value : Option < & str > ) {
283
311
hostcalls:: set_map_value ( MapType :: HttpRequestHeaders , & name, value) . unwrap ( )
284
312
}
285
313
314
+ fn set_http_request_header_bytes ( & self , name : & str , value : Option < & [ u8 ] > ) {
315
+ hostcalls:: set_map_value_bytes ( MapType :: HttpRequestHeaders , name, value) . unwrap ( )
316
+ }
317
+
286
318
fn add_http_request_header ( & self , name : & str , value : & str ) {
287
319
hostcalls:: add_map_value ( MapType :: HttpRequestHeaders , & name, value) . unwrap ( )
288
320
}
289
321
322
+ fn add_http_request_header_bytes ( & self , name : & str , value : & [ u8 ] ) {
323
+ hostcalls:: add_map_value_bytes ( MapType :: HttpRequestHeaders , name, value) . unwrap ( )
324
+ }
325
+
290
326
fn on_http_request_body ( & mut self , _body_size : usize , _end_of_stream : bool ) -> Action {
291
327
Action :: Continue
292
328
}
@@ -307,22 +343,42 @@ pub trait HttpContext: Context {
307
343
hostcalls:: get_map ( MapType :: HttpRequestTrailers ) . unwrap ( )
308
344
}
309
345
346
+ fn get_http_request_trailers_bytes ( & self ) -> Vec < ( String , Bytes ) > {
347
+ hostcalls:: get_map_bytes ( MapType :: HttpRequestTrailers ) . unwrap ( )
348
+ }
349
+
310
350
fn set_http_request_trailers ( & self , trailers : Vec < ( & str , & str ) > ) {
311
351
hostcalls:: set_map ( MapType :: HttpRequestTrailers , trailers) . unwrap ( )
312
352
}
313
353
354
+ fn set_http_request_trailers_bytes ( & self , trailers : Vec < ( & str , & [ u8 ] ) > ) {
355
+ hostcalls:: set_map_bytes ( MapType :: HttpRequestTrailers , trailers) . unwrap ( )
356
+ }
357
+
314
358
fn get_http_request_trailer ( & self , name : & str ) -> Option < String > {
315
359
hostcalls:: get_map_value ( MapType :: HttpRequestTrailers , & name) . unwrap ( )
316
360
}
317
361
362
+ fn get_http_request_trailer_bytes ( & self , name : & str ) -> Option < Bytes > {
363
+ hostcalls:: get_map_value_bytes ( MapType :: HttpRequestTrailers , name) . unwrap ( )
364
+ }
365
+
318
366
fn set_http_request_trailer ( & self , name : & str , value : Option < & str > ) {
319
367
hostcalls:: set_map_value ( MapType :: HttpRequestTrailers , & name, value) . unwrap ( )
320
368
}
321
369
370
+ fn set_http_request_trailer_bytes ( & self , name : & str , value : Option < & [ u8 ] > ) {
371
+ hostcalls:: set_map_value_bytes ( MapType :: HttpRequestTrailers , name, value) . unwrap ( )
372
+ }
373
+
322
374
fn add_http_request_trailer ( & self , name : & str , value : & str ) {
323
375
hostcalls:: add_map_value ( MapType :: HttpRequestTrailers , & name, value) . unwrap ( )
324
376
}
325
377
378
+ fn add_http_request_trailer_bytes ( & self , name : & str , value : & [ u8 ] ) {
379
+ hostcalls:: add_map_value_bytes ( MapType :: HttpRequestTrailers , name, value) . unwrap ( )
380
+ }
381
+
326
382
fn resume_http_request ( & self ) {
327
383
hostcalls:: resume_http_request ( ) . unwrap ( )
328
384
}
@@ -335,22 +391,42 @@ pub trait HttpContext: Context {
335
391
hostcalls:: get_map ( MapType :: HttpResponseHeaders ) . unwrap ( )
336
392
}
337
393
394
+ fn get_http_response_headers_bytes ( & self ) -> Vec < ( String , Bytes ) > {
395
+ hostcalls:: get_map_bytes ( MapType :: HttpResponseHeaders ) . unwrap ( )
396
+ }
397
+
338
398
fn set_http_response_headers ( & self , headers : Vec < ( & str , & str ) > ) {
339
399
hostcalls:: set_map ( MapType :: HttpResponseHeaders , headers) . unwrap ( )
340
400
}
341
401
402
+ fn set_http_response_headers_bytes ( & self , headers : Vec < ( & str , & [ u8 ] ) > ) {
403
+ hostcalls:: set_map_bytes ( MapType :: HttpResponseHeaders , headers) . unwrap ( )
404
+ }
405
+
342
406
fn get_http_response_header ( & self , name : & str ) -> Option < String > {
343
407
hostcalls:: get_map_value ( MapType :: HttpResponseHeaders , & name) . unwrap ( )
344
408
}
345
409
410
+ fn get_http_response_header_bytes ( & self , name : & str ) -> Option < Bytes > {
411
+ hostcalls:: get_map_value_bytes ( MapType :: HttpResponseHeaders , name) . unwrap ( )
412
+ }
413
+
346
414
fn set_http_response_header ( & self , name : & str , value : Option < & str > ) {
347
415
hostcalls:: set_map_value ( MapType :: HttpResponseHeaders , & name, value) . unwrap ( )
348
416
}
349
417
418
+ fn set_http_response_header_bytes ( & self , name : & str , value : Option < & [ u8 ] > ) {
419
+ hostcalls:: set_map_value_bytes ( MapType :: HttpResponseHeaders , name, value) . unwrap ( )
420
+ }
421
+
350
422
fn add_http_response_header ( & self , name : & str , value : & str ) {
351
423
hostcalls:: add_map_value ( MapType :: HttpResponseHeaders , & name, value) . unwrap ( )
352
424
}
353
425
426
+ fn add_http_response_header_bytes ( & self , name : & str , value : & [ u8 ] ) {
427
+ hostcalls:: add_map_value_bytes ( MapType :: HttpResponseHeaders , name, value) . unwrap ( )
428
+ }
429
+
354
430
fn on_http_response_body ( & mut self , _body_size : usize , _end_of_stream : bool ) -> Action {
355
431
Action :: Continue
356
432
}
@@ -371,22 +447,42 @@ pub trait HttpContext: Context {
371
447
hostcalls:: get_map ( MapType :: HttpResponseTrailers ) . unwrap ( )
372
448
}
373
449
374
- fn set_http_response_trailers ( & self , headers : Vec < ( & str , & str ) > ) {
375
- hostcalls:: set_map ( MapType :: HttpResponseTrailers , headers) . unwrap ( )
450
+ fn get_http_response_trailers_bytes ( & self ) -> Vec < ( String , Bytes ) > {
451
+ hostcalls:: get_map_bytes ( MapType :: HttpResponseTrailers ) . unwrap ( )
452
+ }
453
+
454
+ fn set_http_response_trailers ( & self , trailers : Vec < ( & str , & str ) > ) {
455
+ hostcalls:: set_map ( MapType :: HttpResponseTrailers , trailers) . unwrap ( )
456
+ }
457
+
458
+ fn set_http_response_trailers_bytes ( & self , trailers : Vec < ( & str , & [ u8 ] ) > ) {
459
+ hostcalls:: set_map_bytes ( MapType :: HttpResponseTrailers , trailers) . unwrap ( )
376
460
}
377
461
378
462
fn get_http_response_trailer ( & self , name : & str ) -> Option < String > {
379
463
hostcalls:: get_map_value ( MapType :: HttpResponseTrailers , & name) . unwrap ( )
380
464
}
381
465
466
+ fn get_http_response_trailer_bytes ( & self , name : & str ) -> Option < Bytes > {
467
+ hostcalls:: get_map_value_bytes ( MapType :: HttpResponseTrailers , name) . unwrap ( )
468
+ }
469
+
382
470
fn set_http_response_trailer ( & self , name : & str , value : Option < & str > ) {
383
471
hostcalls:: set_map_value ( MapType :: HttpResponseTrailers , & name, value) . unwrap ( )
384
472
}
385
473
474
+ fn set_http_response_trailer_bytes ( & self , name : & str , value : Option < & [ u8 ] > ) {
475
+ hostcalls:: set_map_value_bytes ( MapType :: HttpResponseTrailers , name, value) . unwrap ( )
476
+ }
477
+
386
478
fn add_http_response_trailer ( & self , name : & str , value : & str ) {
387
479
hostcalls:: add_map_value ( MapType :: HttpResponseTrailers , & name, value) . unwrap ( )
388
480
}
389
481
482
+ fn add_http_response_trailer_bytes ( & self , name : & str , value : & [ u8 ] ) {
483
+ hostcalls:: add_map_value_bytes ( MapType :: HttpResponseTrailers , name, value) . unwrap ( )
484
+ }
485
+
390
486
fn resume_http_response ( & self ) {
391
487
hostcalls:: resume_http_response ( ) . unwrap ( )
392
488
}
0 commit comments