mirror of https://github.com/grpc/grpc-dart.git
Tweaks. (#82)
Using address: 'localhost' didn't work as expected in the Docker environment, so reverting to old behavior. Fixed a typo.
This commit is contained in:
parent
38ad37e2ef
commit
88485bad11
|
@ -136,7 +136,6 @@ Future<Null> main(List<String> args) async {
|
|||
tlsCredentials = new ServerTlsCredentials(
|
||||
certificate: await certificate, privateKey: await privateKey);
|
||||
}
|
||||
await server.serve(
|
||||
address: 'localhost', port: port, security: tlsCredentials);
|
||||
await server.serve(port: port, security: tlsCredentials);
|
||||
print('Server listening on port ${server.port}...');
|
||||
}
|
||||
|
|
|
@ -246,26 +246,26 @@ class ServerHandler extends ServiceCall {
|
|||
void sendTrailers({int status = 0, String message}) {
|
||||
_timeoutTimer?.cancel();
|
||||
|
||||
final outogingTrailersMap = <String, String>{};
|
||||
final outgoingTrailersMap = <String, String>{};
|
||||
if (!_headersSent) {
|
||||
// TODO(jakobr): Should come from package:http2?
|
||||
outogingTrailersMap[':status'] = '200';
|
||||
outogingTrailersMap['content-type'] = 'application/grpc';
|
||||
outgoingTrailersMap[':status'] = '200';
|
||||
outgoingTrailersMap['content-type'] = 'application/grpc';
|
||||
|
||||
_customHeaders..remove(':status')..remove('content-type');
|
||||
outogingTrailersMap.addAll(_customHeaders);
|
||||
outgoingTrailersMap.addAll(_customHeaders);
|
||||
_customHeaders = null;
|
||||
}
|
||||
_customTrailers..remove(':status')..remove('content-type');
|
||||
outogingTrailersMap.addAll(_customTrailers);
|
||||
outgoingTrailersMap.addAll(_customTrailers);
|
||||
_customTrailers = null;
|
||||
outogingTrailersMap['grpc-status'] = status.toString();
|
||||
outgoingTrailersMap['grpc-status'] = status.toString();
|
||||
if (message != null) {
|
||||
outogingTrailersMap['grpc-message'] = message;
|
||||
outgoingTrailersMap['grpc-message'] = message;
|
||||
}
|
||||
|
||||
final outgoingTrailers = <Header>[];
|
||||
outogingTrailersMap.forEach(
|
||||
outgoingTrailersMap.forEach(
|
||||
(key, value) => outgoingTrailers.add(new Header.ascii(key, value)));
|
||||
_stream.sendHeaders(outgoingTrailers, endStream: true);
|
||||
// We're done!
|
||||
|
|
Loading…
Reference in New Issue