Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Dart HTTP response header handling #1062

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

randomizedcoder
Copy link

Document the dart client HTTP response header handling, to help with issue: #726


  • [ X] I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

Copy link

google-cla bot commented Nov 30, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.


## Response Headers

The Dart HTTP client by default allows only the CORS-safelisted response headers:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for BrowserClient-only, right? I'm not sure that this is the best place to add this documentation.

The documentation would logically belong to BrowserClient but people are unlikely to look there.

Maybe add a note in the headers field.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

G'day @brianquinlan

Thanks for the reply.

I moved the comments into https://pub.dev/documentation/http/latest/http/BaseResponse/headers.html, as you suggested.

How does the PR look now? I have no idea what is gong on with the changelog. I just checked the Master branch I clone, and it has "-" chars.

Thanks,
Dave

@@ -1,234 +1,238 @@
## 1.1.3

- Document HTTP client response header handling
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you replaced "" with "-" - it is "" at HEAD: https://github.com/dart-lang/http/blob/master/pkgs/http/CHANGELOG.md?plain=1

Could you change the version to:

1.1.3-wip

And make the same change in pubspec.yaml

@@ -46,6 +46,19 @@ abstract class BaseResponse {
/// If a header value contains whitespace then that whitespace may be replaced
/// by a single space. Leading and trailing whitespace in header values are
/// always removed.
///
/// Please keep in mind that the Dart HTTP client is likely to be running side
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this might be too verbose. How about:

Some headers may be excluded by the client for security or privacy reasons. For example, browser-cased clients can only return headers in the CORS safelist or specifically allowed by the server.

@randomizedcoder
Copy link
Author

randomizedcoder commented Dec 17, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants