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
[WebView] Add additionalHttpHeaders to WebContent.Url #1089
Conversation
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). For more information, open the CLA check for this pull request. |
@bentrengrove Can you please have a look at this PR? |
I think if we were to support this you would have to ensure those additional headers weren't lost when the page was loaded and the state reassigned. For instance, you might need the headers passed across multiple redirects and the way it is right now they wouldn't be. |
I can make sure that the headers are not lost by using the |
Oh, I get it know. You mean when |
I don't think a mutable map is the solution here. Does webview actually return the headers it used in onPageFinished or anything like that where we update our state? We basically try to mirror the state of the webview with our state class, that is why it is reassigned all the time. If that was the case then we could store the headers again there. |
I'm just passing a mutable map because the documentation of
I don't think we have access to the actual headers that are used by |
Since the attribute is called With the current implementation, |
Is there anything left to do? |
Yes, we would still need tests and documentation in order to merge this in. You would also need to run |
Could probably make the header map non-nullable, default it to |
Sure, why not. I don't have a strong opinion on that one. What do you think @bentrengrove? |
I updated the documentation, metadata and added a test. Hope you like it 🤞🏼😃 PS: How can I get rid of the following error when calling any Gradle command?
I had to temporarily comment out the |
This all looks good to me and I like the As for the sonatype error, I am not actually sure! I am not seeing that here. |
Branch is now rebased on
Is there anything else to do after checking out the project via Git? Maybe I'm missing some environment variables? |
Thanks for the rebase. I can't spot anything environment variables in my setup at all, there shouldn't be anything you have to do |
Hm, it seems the test is flaky?
|
I pushed another commit, trying to work around the flaky test similar to |
That test is marked as flaky with an issue for it to be fixed, as in it is currently broken. Copying that test is not a valid workaround sorry. You might just be able to increase the timeout. |
I assumed both tests are flaky because they both use |
Happy to rerun it for you but yeah my point is that I think it will still be flaky because that test is currently marked as flaky, it's not working around anything. |
Please rerun :) If it works now I will remove the annotation. |
I removed the annotation and increased the timeout. However the test that was failing for the latest run is |
By the way, the test was / is "working on my computer" even before the latest modifications. So it's really hard for me to reproduce and fix this 😐 |
Unfortunately the test is still failing 😞 Do you @bentrengrove have an idea? Because I've run out of ideas 🤷🏼♂️ |
Maybe go back to the original version of the test when I approved it, add the flaky annotation and then I will have a look and see if I can fix both tests at the same time |
I reverted the test changes |
Thank you! |
I have a use case where I need to pass additional HTTP headers to
WebView.loadUrl()
.While extending
WebContent.Url
I noticed thatstate.content
is reassigned in several callback methods ofWebViewClient
, for example inshouldOverrideUrlLoading()
. WhileadditionalHttpHeaders
are used for the initialloadUrl()
call, this means that the state propertyadditionalHttpHeaders
is lost on reassignment. I'm not sure if this poses an issue and if so how to handle this situation.