mirror of https://github.com/grpc/grpc-node.git
Merge pull request #632 from murgatroid99/mock_fix
Add missing sendTrailers method in ClientHttp2StreamMock
This commit is contained in:
commit
385456eca5
|
@ -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', () => {
|
||||||
|
|
Loading…
Reference in New Issue