@@ -316,20 +316,12 @@ interface types {
316
316
/// future to determine whether the body was received successfully.
317
317
/// The future will only resolve after the stream is reported as closed.
318
318
///
319
- /// The stream and future returned by this method are children:
320
- /// they should be closed or consumed before the parent `response`
321
- /// is dropped, or its ownership is transferred to another component
322
- /// by e.g. `handler.handle` .
319
+ /// This function takes a `res` future as a parameter, which can be used to
320
+ /// communicate an error in handling of the request.
323
321
///
324
- /// This method may be called multiple times.
325
- ///
326
- /// This method will return an error if it is called while either:
327
- /// - a stream or future returned by a previous call to this method is still open
328
- /// - a stream returned by a previous call to this method has reported itself as closed
329
- /// Thus there will always be at most one readable stream open for a given body.
330
- /// Each subsequent stream picks up where the previous one left off,
331
- /// continuing until the entire body has been consumed.
332
- consume-body : func () -> result <tuple <stream <u8 >, future <result <option <trailers >, error-code >>>>;
322
+ /// Note that function will move the `request` , but references to headers or
323
+ /// request options acquired from it previously will remain valid.
324
+ consume-body : static func (this : request , res : future <result <_ , error-code >>) -> tuple <stream <u8 >, future <result <option <trailers >, error-code >>>;
333
325
}
334
326
335
327
/// Parameters for making an HTTP Request. Each of these parameters is
@@ -417,19 +409,11 @@ interface types {
417
409
/// future to determine whether the body was received successfully.
418
410
/// The future will only resolve after the stream is reported as closed.
419
411
///
420
- /// The stream and future returned by this method are children:
421
- /// they should be closed or consumed before the parent `response`
422
- /// is dropped, or its ownership is transferred to another component
423
- /// by e.g. `handler.handle` .
424
- ///
425
- /// This method may be called multiple times.
412
+ /// This function takes a `res` future as a parameter, which can be used to
413
+ /// communicate an error in handling of the response.
426
414
///
427
- /// This method will return an error if it is called while either:
428
- /// - a stream or future returned by a previous call to this method is still open
429
- /// - a stream returned by a previous call to this method has reported itself as closed
430
- /// Thus there will always be at most one readable stream open for a given body.
431
- /// Each subsequent stream picks up where the previous one left off,
432
- /// continuing until the entire body has been consumed.
433
- consume-body : func () -> result <tuple <stream <u8 >, future <result <option <trailers >, error-code >>>>;
415
+ /// Note that function will move the `response` , but references to headers
416
+ /// acquired from it previously will remain valid.
417
+ consume-body : static func (this : response , res : future <result <_ , error-code >>) -> tuple <stream <u8 >, future <result <option <trailers >, error-code >>>;
434
418
}
435
419
}
0 commit comments