Skip to content

Commit e70a41b

Browse files
authored
Clarify that some headers may not be sent/received (#1768)
1 parent d99cc3c commit e70a41b

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

pkgs/http/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.4.1
2+
3+
* Clarify that some header names may not be sent/received.
4+
15
## 1.4.0
26

37
* Fixed default encoding for application/json without a charset

pkgs/http/lib/src/base_request.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ abstract class BaseRequest {
8181

8282
// TODO(nweiz): automatically parse cookies from headers
8383

84-
// TODO(nweiz): make this a HttpHeaders object
84+
/// The HTTP headers sent to the server.
85+
///
86+
/// Header names are converted to lowercase when sent to the server.
87+
///
88+
/// Some headers may not be sent by the [Client] for security or privacy
89+
/// reasons. For example, browser-based clients may only sent headers in the
90+
/// CORS safelist or specifically allowed by the server.
8591
final Map<String, String> headers;
8692

8793
/// Whether [finalize] has been called.

pkgs/http/lib/src/base_response.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ abstract class BaseResponse {
5252
/// If a header value contains whitespace then that whitespace may be replaced
5353
/// by a single space. Leading and trailing whitespace in header values are
5454
/// always removed.
55+
///
56+
/// Some headers may be excluded by the [Client] for security or privacy
57+
/// reasons. For example, browser-based clients can only return headers in the
58+
/// CORS safelist or specifically allowed by the server.
5559
final Map<String, String> headers;
5660

5761
final bool isRedirect;

pkgs/http/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: http
2-
version: 1.4.0
2+
version: 1.4.1-wip
33
description: A composable, multi-platform, Future-based API for HTTP requests.
44
repository: https://github.com/dart-lang/http/tree/master/pkgs/http
55

0 commit comments

Comments
 (0)