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

Add new class RequestHeaders #14

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft

Conversation

DikoIbragimov
Copy link

Q A
Is bugfix?
New feature? ✔️
Breaks BC?

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (7c4d671) to head (40de885).
Report is 20 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##              master       #14   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity         6        16   +10     
===========================================
  Files              3         5    +2     
  Lines             13        32   +19     
===========================================
+ Hits              13        32   +19     

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

Copy link
Member

@vjik vjik left a comment

Choose a reason for hiding this comment

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

It's good idea for me 👍

Also need methods to get all headers ($request->getHeaders()) and get header values as array ($request->getHeader()).

src/RequestHeaders.php Outdated Show resolved Hide resolved
src/RequestHeaders.php Outdated Show resolved Hide resolved
…ding new methods for getting request headers in different formats and corresponding tests
@xepozz
Copy link
Member

xepozz commented Dec 12, 2024

I'd recommended to think about providing (setting) custom headers like error-handler does.


namespace Yiisoft\RequestProvider;

final class RequestHeaders {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
final class RequestHeaders {
final class RequestHeaderProvider {

Copy link
Member

Choose a reason for hiding this comment

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

Suggested name is not consistent with RequestCookies.

Copy link
Member

Choose a reason for hiding this comment

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

RequestCookies is inconsistent with the rest Yii3 packages as well

Copy link
Member

Choose a reason for hiding this comment

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

Agree. RequestHeaderProvider is better name.

Copy link
Author

Choose a reason for hiding this comment

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

Maybe a RequestHeaderCollection?

Copy link
Member

Choose a reason for hiding this comment

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

Also good, but it's not a classic collection. Very custom implementation that depends on another class. It's more proxy than collection.
ProxyCollection? 😁

src/RequestHeaders.php Show resolved Hide resolved
use Yiisoft\RequestProvider\RequestHeaders;
use Yiisoft\RequestProvider\RequestProviderInterface;

final class RequestHeadersTest extends TestCase {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
final class RequestHeadersTest extends TestCase {
final class RequestHeaderProviderTest extends TestCase {

src/RequestHeaders.php Outdated Show resolved Hide resolved
Co-authored-by: Rustam Mamadaminov <[email protected]>
src/RequestHeaders.php Outdated Show resolved Hide resolved
src/RequestHeaders.php Outdated Show resolved Hide resolved
src/RequestHeaders.php Outdated Show resolved Hide resolved
src/RequestHeaders.php Outdated Show resolved Hide resolved
src/RequestHeaders.php Outdated Show resolved Hide resolved
src/RequestHeaders.php Show resolved Hide resolved
@vjik vjik added the status:under development Someone is working on a pull request. label Dec 15, 2024
@samdark samdark marked this pull request as draft December 16, 2024 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:under development Someone is working on a pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants