ShaftHQ / SHAFT_ENGINE

SHAFT is a unified test automation engine for web, mobile, API, CLI, database, and desktop e2e testing. Powered by best-in-class frameworks, SHAFT provides a wizard-like syntax to drive your automation efficiently, maximize your ROI, and minimize your learning curve with no limitations! Stop reinventing the wheel! Upgrade now!
https://shafthq.github.io/
MIT License
324 stars 123 forks source link

Fix: Ensure query parameters are added to requests with a body #1634

Closed KyrillosNageh closed 2 months ago

KyrillosNageh commented 3 months ago

This pull request fixes a bug where query parameters were not being added to requests that also have a body. It improves the performRequest method to ensure query parameters are correctly appended to the URL, along with enhancing error handling and modularizing the code.

src/main/java/com/shaft/api/RequestBuilder.java

When making HTTP requests with both query parameters and a request body, the query parameters were ignored, resulting in incorrect request URLs.

Dynamic URL Construction: Added functionality to append query parameters to the request URL, ensuring they are not lost when a body is present. Comprehensive Error Management: Improved exception handling to manage errors during the request process effectively. Modular Helper Methods: Created helper methods to append query parameters, check supported request types, and handle exceptions.

Linked Issue: Fixes https://github.com/ShaftHQ/SHAFT_ENGINE/issues/1615

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 35.71429% with 27 lines in your changes missing coverage. Please review.

Project coverage is 54.23%. Comparing base (3c6b582) to head (6b22d7a).

Files Patch % Lines
src/main/java/com/shaft/api/RequestBuilder.java 35.71% 21 Missing and 6 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1634 +/- ## ============================================ - Coverage 54.45% 54.23% -0.23% Complexity 1363 1363 ============================================ Files 112 112 Lines 10010 10031 +21 Branches 973 971 -2 ============================================ - Hits 5451 5440 -11 - Misses 3949 3979 +30 - Partials 610 612 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.