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(client): Implement RawRequestBuilder for raw HTTP requests #257

Merged
merged 9 commits into from
Aug 31, 2024

Conversation

surajk-m
Copy link
Contributor

Closes #148

This PR introduces a RawRequestBuilder struct to handle raw HTTP requests with optional cookie handling.

Builder Pattern Implementation:

  • RawRequestBuilder for setting HTTP method (method), URL (url), optional cookie URL (cookie_url), request modification function (map_request), and sending the request (send).
  • Added raw_request method to the Client struct to initialize the RawRequestBuilder.

@surajk-m surajk-m force-pushed the feat/raw-request-builder branch 2 times, most recently from f2131c8 to a4f9545 Compare June 29, 2024 17:45
src/client.rs Outdated Show resolved Hide resolved
src/client.rs Outdated Show resolved Hide resolved
src/client.rs Show resolved Hide resolved
src/client.rs Show resolved Hide resolved
src/client.rs Outdated Show resolved Hide resolved
src/client.rs Outdated Show resolved Hide resolved
src/client.rs Outdated Show resolved Hide resolved
@jonhoo
Copy link
Owner

jonhoo commented Jul 14, 2024

Thanks for taking this on, and sorry it ended up landing right in the middle of the hyper 1.0 change 😅

@surajk-m
Copy link
Contributor Author

Thanks for the update and suggestions! I appreciate your work on fantoccini lib.

Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

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

Excellent — just a few more tweaks now and I think we're there!

src/client.rs Outdated Show resolved Hide resolved
src/client.rs Outdated Show resolved Hide resolved
src/client.rs Outdated Show resolved Hide resolved
src/client.rs Outdated Show resolved Hide resolved
- Introduce `RawRequestBuilder` struct with optional cookie handling.
- Add methods to set HTTP method, URL, optional cookie URL, and request modification.
- Fix cookie handling by ensuring navigation to the target domain before sending the request.
- Join `current URL` with the `cookie_url`
- Set default value of `cookie_url` to `"/please_give_me_your_cookies"`
- Add option to `opt out` of the cookie navigation process
- Move `get_ua` outside the conditional block
@jonhoo
Copy link
Owner

jonhoo commented Aug 18, 2024

It's actually better if you don't force-push while we're still iterating, since the force pushes make it much harder to track exactly what's changed since last time I looked. We can clean up the history at the very end :)

@surajk-m
Copy link
Contributor Author

Sure, I'll avoid that. Forgot to rebase earlier before pushing.

@jonhoo
Copy link
Owner

jonhoo commented Aug 31, 2024

I made a change so that the various methods are now available for all <F>, but otherwise this now looks good, thank you!

Copy link

codecov bot commented Aug 31, 2024

Codecov Report

Attention: Patch coverage is 53.84615% with 60 lines in your changes missing coverage. Please review.

Project coverage is 62.70%. Comparing base (ed0ba36) to head (ed093eb).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/client.rs 53.84% 60 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/client.rs 63.80% <53.84%> (-2.87%) ⬇️

@jonhoo jonhoo merged commit f106027 into jonhoo:main Aug 31, 2024
18 of 19 checks passed
@jonhoo
Copy link
Owner

jonhoo commented Aug 31, 2024

Released in 0.21.2 🎉

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.

Don't silently hit a URL for raw client cookie support
2 participants