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

use custom user-agent in websocket requests #3137

Merged
merged 2 commits into from
Dec 16, 2022

Conversation

alexbilevskiy
Copy link
Contributor

Summary

Fix user-agent in websocket requests (such as device controls tile in quick settings), use custom values insteadof okhttp/4.10.0
pretty much the same reason as in #1364 and #1418

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

Sorry, I dont have development env, I hope github actions build will work

@home-assistant
Copy link

home-assistant bot commented Dec 5, 2022

Hi alexbilevskiy

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@dshokouhi
Copy link
Member

@jpelgrom
Copy link
Member

jpelgrom commented Dec 5, 2022

I thought we already handled this here for all of our network calls.

Looks like interceptors don't work on websocket requests (also see this StackOverflow post). As we're only adding one header the suggested change should be OK in my opinion.

I hope github actions build will work

It currently doesn't because of actions/setup-java#422, but when that is fixed it still won't work because:

  • you need to add an import statement for the added constants
  • the USER_AGENT constant is currently private

I'd recommend editing with an IDE like Android Studio to help you catch errors like these.

@dshokouhi
Copy link
Member

I thought we already handled this here for all of our network calls.

Looks like interceptors don't work on websocket requests (also see this StackOverflow post). As we're only adding one header the suggested change should be OK in my opinion.

In that case this PR is a good find!

@alexbilevskiy
Copy link
Contributor Author

alexbilevskiy commented Dec 6, 2022

it still won't work because:

fixed

I'd recommend editing with an IDE like Android Studio to help you catch errors like these.

Did so. No more errors reported.

Copy link
Member

@dshokouhi dshokouhi left a comment

Choose a reason for hiding this comment

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

Looks good to me! Nice catch.

@JBassett JBassett merged commit c3349bb into home-assistant:master Dec 16, 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.

4 participants