Rewrite streams (#4842)

This commit is contained in:
Kitson Kelly 2020-04-23 00:06:51 +10:00 committed by GitHub
parent b270d6c8d0
commit 8bcfc03d71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 2008 additions and 4952 deletions

View file

@ -1,9 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import * as body from "./body.ts";
import * as domTypes from "./dom_types.d.ts";
import * as streams from "./streams/mod.ts";
const { ReadableStream } = streams;
import { ReadableStreamImpl } from "./streams/readable_stream.ts";
function byteUpperCase(s: string): string {
return String(s).replace(/[a-z]/g, function byteUpperCaseReplace(c): string {
@ -124,8 +122,8 @@ export class Request extends body.Body implements domTypes.Request {
let body2 = this._bodySource;
if (this._bodySource instanceof ReadableStream) {
const tees = (this._bodySource as domTypes.ReadableStream).tee();
if (this._bodySource instanceof ReadableStreamImpl) {
const tees = this._bodySource.tee();
this._stream = this._bodySource = tees[0];
body2 = tees[1];
}