Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[flutter_image] Add custom request headers.#374

Merged
stuartmorgan-g merged 16 commits intoflutter:masterfrom
altera2015:custom_headers
Jul 12, 2021
Merged

[flutter_image] Add custom request headers.#374
stuartmorgan-g merged 16 commits intoflutter:masterfrom
altera2015:custom_headers

Conversation

@altera2015
Copy link
Contributor

@altera2015 altera2015 commented Jun 8, 2021

This PR adds custom request headers to address issue flutter/flutter#19532.

Pre-launch Checklist

  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt.
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy].
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.

1. Change version number to 4.1.0
2. Removed preserveHeaderCase
3. Improved documentation
4. Reversed unit test conditional order
@altera2015 altera2015 requested a review from stuartmorgan-g June 9, 2021 01:47
Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, just a few small nits left.

const NetworkImageWithRetry(this.url,
{this.scale = 1.0,
this.fetchStrategy = defaultFetchStrategy,
this.requestHeaders});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: please add the trailing comma so the more legible formatting is kept.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

/// values will be used as the header values. A list of header names can
/// be found at https://datatracker.ietf.org/doc/html/rfc7231#section-8.3
///
/// Some headers are single valued, and for these, adding a value will
Copy link
Collaborator

Choose a reason for hiding this comment

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

This sentence doesn't make sense in the context of this API, which isn't an add.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this sentence.

/// the same when converted to lower-case, they are considered to be
/// the same header, with one set of values.
///
/// Example, adding Basic Authentication to requests.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"For example, to add an authorization header to the request:"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated sentence.

/// Example, adding Basic Authentication to requests.
///
/// final NetworkImageWithRetry subject = NetworkImageWithRetry(
/// Uri.parse('http://www.flutter.com/top_secret.png'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Use https if you're showing an example of sending passwords; we shouldn't have examples that demonstrate bad practice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed!

/// Example, adding Basic Authentication to requests.
///
/// final NetworkImageWithRetry subject = NetworkImageWithRetry(
/// Uri.parse('http://www.flutter.com/top_secret.png'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please ident 2, not 1, in a continuation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@altera2015
Copy link
Contributor Author

altera2015 commented Jul 4, 2021

@stuartmorgan I've pushed an update, however CI appears to be broken at the moment.

❗ Failed to stop: Error getting access token for service account: 400 Bad Request POST https://oauth2.googleapis.com/token {"error":"invalid_grant","error_description":"Invalid JWT Signature."}, iss: [email protected]

@altera2015 altera2015 requested a review from stuartmorgan-g July 8, 2021 01:03
@stuartmorgan-g
Copy link
Collaborator

@stuartmorgan I've pushed an update, however CI appears to be broken at the moment.

I believe this is due to a credential issue that required a fix in the repository, so you'll need to merge in the latest master.

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

One tiny nit, plus you seem to have reformatted the entire file with a different line length, which will need to be undone. LGTM with those changes though.

/// the same when converted to lower-case, they are considered to be
/// the same header, with one set of values.
///
/// For example, to add an authorization header to the request.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: This should end with :, not ..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@altera2015 altera2015 requested a review from stuartmorgan-g July 8, 2021 16:38
Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@stuartmorgan-g stuartmorgan-g merged commit d17341b into flutter:master Jul 12, 2021
austinstoker pushed a commit to austinstoker/packages that referenced this pull request Apr 29, 2022
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