mirror of https://github.com/grpc/grpc-dart.git
Fix issue 669 (#693)
* Fix issue 669 * Update CHANGELOG.md * Update CHANGELOG.md * Fix dart format issue. Fix prefer single quote issue. * Update pubspec and changelog to avoid merge check publish / validate validate packages * Add test for GRPC Compression Flag * Fix dart analyze issues. * Fix latest dart analyze issue (uninizialized variable)
This commit is contained in:
parent
bb8b6e5950
commit
bdbe5f5003
|
@ -1,3 +1,7 @@
|
|||
## 3.2.5
|
||||
|
||||
* Set compressed flag correctly for grpc-encoding = identity. Fixes [#669](https://github.com/grpc/grpc-dart/issues/669) (https://github.com/grpc/grpc-dart/pull/693)
|
||||
|
||||
## 3.2.4
|
||||
|
||||
* Forward internal `GrpcError` on when throwing while sending a request.
|
||||
|
|
|
@ -68,7 +68,8 @@ List<int> frame(List<int> rawPayload, [Codec? codec]) {
|
|||
final payloadLength = compressedPayload.length;
|
||||
final bytes = Uint8List(payloadLength + 5);
|
||||
final header = bytes.buffer.asByteData(0, 5);
|
||||
header.setUint8(0, codec == null ? 0 : 1);
|
||||
header.setUint8(
|
||||
0, (codec == null || codec.encodingName == 'identity') ? 0 : 1);
|
||||
header.setUint32(1, payloadLength);
|
||||
bytes.setRange(5, bytes.length, compressedPayload);
|
||||
return bytes;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: grpc
|
||||
description: Dart implementation of gRPC, a high performance, open-source universal RPC framework.
|
||||
version: 3.2.4
|
||||
version: 3.2.5
|
||||
|
||||
repository: https://github.com/grpc/grpc-dart
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
import 'package:grpc/src/shared/codec.dart';
|
||||
import 'package:grpc/src/shared/message.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group('GRPC Compression Flag', () {
|
||||
test('compression flag 0 with null codec', () {
|
||||
final rawPayload = <int>[1, 2, 3, 4];
|
||||
final Codec? codec = null;
|
||||
final data = frame(rawPayload, codec);
|
||||
expect(data[0], 0);
|
||||
});
|
||||
test('compression flag 0 with grpc-encoding identity', () {
|
||||
final rawPayload = <int>[1, 2, 3, 4];
|
||||
final Codec codec = IdentityCodec();
|
||||
final data = frame(rawPayload, codec);
|
||||
expect(data[0], 0);
|
||||
});
|
||||
test('compression flag 1 with grpc-encoding gzip', () {
|
||||
final rawPayload = <int>[1, 2, 3, 4];
|
||||
final Codec codec = GzipCodec();
|
||||
final data = frame(rawPayload, codec);
|
||||
expect(data[0], 1);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue