-
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add http fields to
span.data
(#1497)
Co-authored-by: Manoel Aranda Neto <[email protected]>
- Loading branch information
1 parent
8932ece
commit 5d2b46d
Showing
9 changed files
with
75 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:meta/meta.dart'; | ||
|
||
/// Helper to extract header data | ||
@internal | ||
class HttpHeaderUtils { | ||
/// Get `Content-Length` header | ||
static int? getContentLength(Map<String, List<String>> headers) { | ||
final contentLengthHeader = | ||
headers['content-length'] ?? headers['Content-Length']; | ||
if (contentLengthHeader != null && contentLengthHeader.isNotEmpty) { | ||
final headerValue = contentLengthHeader.first; | ||
return int.tryParse(headerValue); | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:sentry/sentry.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
test('get content length lower case', () { | ||
final headers = { | ||
'content-length': ['12'] | ||
}; | ||
expect(HttpHeaderUtils.getContentLength(headers), 12); | ||
}); | ||
|
||
test('get content length camel case', () { | ||
final headers = { | ||
'Content-Length': ['12'] | ||
}; | ||
expect(HttpHeaderUtils.getContentLength(headers), 12); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters