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

feat: add HTTP headers through reachabilityHeaders param to NetInfoConfiguration #673

Merged
merged 2 commits into from Nov 1, 2023

Conversation

webraptor
Copy link
Contributor

Overview

We've been using react-native-netinfo for quite some time now. We recently needed a change where we can pass along custom headers to the reachability request. This PR adds a new reachabilityHeaders prop to NetInfoConfiguration so that HTTP headers can be set on the request.

Test Plan

Ran the entire test suite & validation the project has, ensured code style matches. We also tested the integration within our project to validate the functionality against our backend which requires custom headers be present in the request.

Screenshot 2023-06-07 at 14 53 29

@webraptor
Copy link
Contributor Author

webraptor commented Sep 12, 2023

@matt-oakes @mikehardy any idea when you'll have time to look into this PR?

@webraptor
Copy link
Contributor Author

@matt-oakes @mikehardy any updates guys?

Copy link
Contributor

@mikehardy mikehardy 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, incredibly busy unfortunately.
Thank you for your patience
This looks fine though, thank you for the contribution!

@mikehardy mikehardy added the pending merge A PR that will be merged shortly, waiting for CI or final comment label Nov 1, 2023
@mikehardy mikehardy merged commit 0cbf067 into react-native-netinfo:master Nov 1, 2023
2 checks passed
@mikehardy mikehardy removed the pending merge A PR that will be merged shortly, waiting for CI or final comment label Nov 1, 2023
github-actions bot pushed a commit that referenced this pull request Nov 1, 2023
# [9.5.0](v9.4.2...v9.5.0) (2023-11-01)

### Features

* add optional reachabilityHeaders param to NetInfoConfiguration ([#673](#673)) ([0cbf067](0cbf067))
@matt-oakes
Copy link
Collaborator

🎉 This PR is included in version 9.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@@ -115,6 +115,7 @@ export type NetInfoSubscription = () => void;
export interface NetInfoConfiguration {
reachabilityUrl: string;
reachabilityMethod?: NetInfoMethodType;
reachabilityHeaders?: HeadersInit;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @webraptor 👋 - this HeadersInit appears undefined, as noted in #693 - what should it be? Seem like it should be whatever valid internet headers are, perhaps { [index: string]: string; } or similar? What do you think?

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

Successfully merging this pull request may close these issues.

None yet

3 participants