Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ref
  • Loading branch information
marandaneto committed Oct 26, 2020
commit e01c8c48c63304e72b9d2a3690ce0ee2b17a6cdf
4 changes: 2 additions & 2 deletions dart/lib/src/transport/encode.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:io';

/// Encodes the body using Gzip compression
void compressBody(List<int> body, Map<String, String> headers) {
List<int> compressBody(List<int> body, Map<String, String> headers) {
headers['Content-Encoding'] = 'gzip';
body = gzip.encode(body);
return gzip.encode(body);
}
2 changes: 1 addition & 1 deletion dart/lib/src/transport/noop_encode.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/// gzip compression is not available on browser
void compressBody(List<int> body, Map<String, String> headers) {}
List<int> compressBody(List<int> body, Map<String, String> headers) => body;
4 changes: 1 addition & 3 deletions dart/lib/src/transport/transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import '../protocol.dart';
import '../sentry_options.dart';
import 'noop_encode.dart' if (dart.library.io) 'encode.dart';

typedef BodyEncoder = Function(List<int> body, Map<String, String> headers);

/// A transport is in charge of sending the event to the Sentry server.
class Transport {
final SentryOptions _options;
Expand Down Expand Up @@ -68,7 +66,7 @@ class Transport {
// gzip compression is not available on browser
var body = utf8.encode(json.encode(data));
if (compressPayload) {
compressBody(body, headers);
body = compressBody(body, headers);
}
return body;
}
Expand Down