Skip to content

Commit 74fcca1

Browse files
author
Pat Hickey
committed
make outgoing-body.finish fallible in case of a Content-Length mismatch
1 parent e181913 commit 74fcca1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

wit/types.wit

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,15 @@ interface types {
515515
/// called to signal that the response is complete. If the `outgoing-body`
516516
/// is dropped without calling `outgoing-body.finalize`, the implementation
517517
/// should treat the body as corrupted.
518-
finish: static func(this: outgoing-body, trailers: option<trailers>);
518+
///
519+
/// Fails if the body's `outgoing-request` or `outgoing-response` was
520+
/// constructed with a Content-Length header, and the contents written
521+
/// to the body (via `write`) does not match the value given in the
522+
/// Content-Length.
523+
finish: static func(
524+
this: outgoing-body,
525+
trailers: option<trailers>
526+
) -> result<_, error-code>;
519527
}
520528

521529
/// Represents a future which may eventaully return an incoming HTTP

0 commit comments

Comments
 (0)