Skip to content

Comments

Add module ifdef guards and helper methods to net::ResourceRequest#59

Merged
RippeR37 merged 2 commits intodevelopfrom
r/module-ifdef-guards/net-request-improvements/1
Apr 21, 2025
Merged

Add module ifdef guards and helper methods to net::ResourceRequest#59
RippeR37 merged 2 commits intodevelopfrom
r/module-ifdef-guards/net-request-improvements/1

Conversation

@RippeR37
Copy link
Owner

This commit adds #ifdef guards to all headers that are for optional modules to ensure that code in them is not processed if the module is not built/installed. At the moment there are no errors, but this may change in the future.

Furthermore, this commit also adds some convenience helper methods to base::net::ResourceRequest to make it easier to create them. Previously user had to provide all parameters until the last intended one (due no designed initializers in C++17). With new methods, users can start with URL and then add parameters as they see fit. Example:

    base::net::ResourceRequest{"https://www.google.com/robots.txt"}
        .WithHeadersOnly()
        .WithTimeout(base::Seconds(5)),

This commit adds #ifdef guards to all headers that are for optional
modules to ensure that code in them is not processed if the module is
not built/installed. At the moment there are no errors, but this may
change in the future.

Furthermore, this commit also adds some convenience helper methods to
`base::net::ResourceRequest` to make it easier to create them.
Previously user had to provide all parameters until the last intended
one (due no designed initializers in C++17). With new methods, users
can start with URL and then add parameters as they see fit. Example:

```cpp
    base::net::ResourceRequest{"https://www.google.com/robots.txt"}
        .WithHeadersOnly()
        .WithTimeout(base::Seconds(5)),
```
@RippeR37 RippeR37 self-assigned this Apr 21, 2025
@codecov
Copy link

codecov bot commented Apr 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.37%. Comparing base (b287439) to head (75240b4).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #59      +/-   ##
===========================================
+ Coverage    58.18%   59.37%   +1.18%     
===========================================
  Files           56       57       +1     
  Lines         1435     1472      +37     
  Branches        87       87              
===========================================
+ Hits           835      874      +39     
+ Misses         600      598       -2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RippeR37 RippeR37 merged commit b981622 into develop Apr 21, 2025
44 checks passed
@RippeR37 RippeR37 deleted the r/module-ifdef-guards/net-request-improvements/1 branch April 21, 2025 23:28
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.

1 participant