File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,16 @@ class Request extends BaseRequest {
69
69
///
70
70
/// This is converted to and from [body] using [encoding] .
71
71
///
72
- /// This list should only be set, not be modified in place.
72
+ /// This list should only be set, not modified in place.
73
+ ///
74
+ /// Unlike [body] , setting [bodyBytes] does not implicitly set a
75
+ /// `Content-Type` header.
76
+ ///
77
+ /// ```dart
78
+ /// final request = Request('GET', Uri.https('example.com', 'whatsit/create'))
79
+ /// ..bodyBytes = utf8.encode(jsonEncode({}))
80
+ /// ..headers['content-type'] = 'application/json';
81
+ /// ```
73
82
Uint8List get bodyBytes => _bodyBytes;
74
83
Uint8List _bodyBytes;
75
84
@@ -86,6 +95,9 @@ class Request extends BaseRequest {
86
95
/// header, one will be added with the type `text/plain` . Then the `charset`
87
96
/// parameter of the `Content-Type` header (whether new or pre-existing) will
88
97
/// be set to [encoding] if it wasn't already set.
98
+ ///
99
+ /// To set the body of the request, without setting the `Content-Type` header,
100
+ /// use [bodyBytes] .
89
101
String get body => encoding.decode (bodyBytes);
90
102
91
103
set body (String value) {
You can’t perform that action at this time.
0 commit comments