Breadcrumb.http constructor

Breadcrumb.http({
  1. required Uri url,
  2. required String method,
  3. int? statusCode,
  4. String? reason,
  5. Duration? requestDuration,
  6. SentryLevel? level,
  7. DateTime? timestamp,
  8. int? requestBodySize,
  9. int? responseBodySize,
  10. String? httpQuery,
  11. String? httpFragment,
})

Implementation

factory Breadcrumb.http({
  required Uri url,
  required String method,
  int? statusCode,
  String? reason,
  Duration? requestDuration,
  SentryLevel? level,
  DateTime? timestamp,

  // Size of the request body in bytes
  int? requestBodySize,

  // Size of the response body in bytes
  int? responseBodySize,
  String? httpQuery,
  String? httpFragment,
}) {
  return Breadcrumb(
    type: 'http',
    category: 'http',
    level: level,
    timestamp: timestamp,
    data: {
      'url': url.toString(),
      'method': method,
      if (statusCode != null) 'status_code': statusCode,
      if (reason != null) 'reason': reason,
      if (requestDuration != null) 'duration': requestDuration.toString(),
      if (requestBodySize != null) 'request_body_size': requestBodySize,
      if (responseBodySize != null) 'response_body_size': responseBodySize,
      if (httpQuery != null) 'http.query': httpQuery,
      if (httpFragment != null) 'http.fragment': httpFragment,
    },
  );
}