From cd42596d4ebf2855a99cb53df55bdd27d6d467ad Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Thu, 7 Jun 2018 21:55:06 +0200 Subject: [PATCH] Add a text encoding step to example 8.9 --- types/whatwg-streams/whatwg-streams-tests.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/types/whatwg-streams/whatwg-streams-tests.ts b/types/whatwg-streams/whatwg-streams-tests.ts index c7ed11928b..56246e0d97 100644 --- a/types/whatwg-streams/whatwg-streams-tests.ts +++ b/types/whatwg-streams/whatwg-streams-tests.ts @@ -371,11 +371,13 @@ declare class Request { readonly url: string; } declare class Response { - constructor(body?: ReadableStream); - readonly body: ReadableStream; + constructor(body?: ReadableStream); + readonly body: ReadableStream; } declare class TextDecoderStream extends TransformStream { } +declare class TextEncoderStream extends TransformStream { +} class LipFuzzTransformer implements TransformStreamTransformer { substitutions: Dictionary; @@ -439,7 +441,9 @@ class LipFuzzTransformer implements TransformStreamTransformer { // Decode the binary-encoded response to string .pipeThrough(new TextDecoderStream()) // Apply the LipFuzzTransformer - .pipeThrough(ts); + .pipeThrough(ts) + // Encode the transformed string + .pipeThrough(new TextEncoderStream()); return new Response(transformedBody); }) );