Merge pull request #632 from murgatroid99/mock_fix

Add missing sendTrailers method in ClientHttp2StreamMock
This commit is contained in:
Nicolas Noble 2018-11-14 15:47:24 -08:00 committed by GitHub
commit 385456eca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import * as assert from 'assert'; import * as assert from 'assert';
import {OutgoingHttpHeaders} from 'http';
import * as http2 from 'http2'; import * as http2 from 'http2';
import {range} from 'lodash'; import {range} from 'lodash';
import * as stream from 'stream'; import * as stream from 'stream';
@ -46,6 +47,9 @@ class ClientHttp2StreamMock extends stream.Duplex implements
endAfterHeaders = false; endAfterHeaders = false;
pending = false; pending = false;
rstCode = 0; rstCode = 0;
readonly sentHeaders: OutgoingHttpHeaders = {};
readonly sentInfoHeaders?: OutgoingHttpHeaders[] = [];
readonly sentTrailers?: OutgoingHttpHeaders = undefined;
// tslint:disable:no-any // tslint:disable:no-any
session: http2.Http2Session = {} as any; session: http2.Http2Session = {} as any;
state: http2.StreamState = {} as any; state: http2.StreamState = {} as any;
@ -76,6 +80,9 @@ class ClientHttp2StreamMock extends stream.Duplex implements
this.emit('write', chunk); this.emit('write', chunk);
cb(); cb();
} }
sendTrailers(headers: OutgoingHttpHeaders) {
return this;
}
} }
describe('CallStream', () => { describe('CallStream', () => {