mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Add a text encoding step to example 8.9
This commit is contained in:
@@ -371,11 +371,13 @@ declare class Request {
|
||||
readonly url: string;
|
||||
}
|
||||
declare class Response {
|
||||
constructor(body?: ReadableStream<any>);
|
||||
readonly body: ReadableStream<ArrayBufferView>;
|
||||
constructor(body?: ReadableStream);
|
||||
readonly body: ReadableStream;
|
||||
}
|
||||
declare class TextDecoderStream extends TransformStream<string, ArrayBufferView> {
|
||||
}
|
||||
declare class TextEncoderStream extends TransformStream<Uint8Array, string> {
|
||||
}
|
||||
|
||||
class LipFuzzTransformer implements TransformStreamTransformer<string, string> {
|
||||
substitutions: Dictionary<string>;
|
||||
@@ -439,7 +441,9 @@ class LipFuzzTransformer implements TransformStreamTransformer<string, string> {
|
||||
// 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);
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user