Skip to content

update http_request method, close #1105#1106

Merged
codeskyblue merged 3 commits intomasterfrom
skip_adb_forward_to_make_httprequest
Jun 15, 2025
Merged

update http_request method, close #1105#1106
codeskyblue merged 3 commits intomasterfrom
skip_adb_forward_to_make_httprequest

Conversation

@codeskyblue
Copy link
Copy Markdown
Member

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 13, 2025

Codecov Report

Attention: Patch coverage is 31.03448% with 20 lines in your changes missing coverage. Please review.

Project coverage is 27.43%. Comparing base (330af23) to head (3ef3748).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
uiautomator2/core.py 31.03% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1106      +/-   ##
==========================================
+ Coverage   27.41%   27.43%   +0.01%     
==========================================
  Files          21       21              
  Lines        2834     2854      +20     
  Branches      427      431       +4     
==========================================
+ Hits          777      783       +6     
- Misses       2028     2042      +14     
  Partials       29       29              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codeskyblue codeskyblue requested a review from Copilot June 13, 2025 12:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the http_request method to use an ADB‐backed HTTP connection instead of port forwarding with the requests library.

  • Introduces a new AdbHTTPConnection subclass of HTTPConnection.
  • Removes legacy port forwarding logic and updates request handling using JSON conversion.

Comment thread uiautomator2/core.py Outdated
Comment thread uiautomator2/core.py Outdated
conn.request(method, path, headers=headers)
else:
conn.request(method, path, json.dumps(data), headers=headers)
except adbutils.AdbError as e:
Copy link

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

It may be beneficial to log the exception details (e.g., using logger.error) before raising HTTPError for easier debugging of adb-related failures.

Suggested change
except adbutils.AdbError as e:
except adbutils.AdbError as e:
logger.error("AdbError occurred while making HTTP request through adb: %s", str(e))

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@XixianLiang XixianLiang left a comment

Choose a reason for hiding this comment

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

close #1105

@sonarqubecloud
Copy link
Copy Markdown

@codeskyblue codeskyblue merged commit c86925b into master Jun 15, 2025
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants