Skip to content

Added configuration option http.middlewares - #14

Merged
tg666 merged 1 commit into
mainfrom
feature/custom-http-middlewares
Jan 30, 2026
Merged

Added configuration option http.middlewares#14
tg666 merged 1 commit into
mainfrom
feature/custom-http-middlewares

Conversation

@tg666

@tg666 tg666 commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added HTTP middlewares configuration option, allowing users to configure custom middlewares for HTTP client requests during setup.

✏️ Tip: You can customize this high-level summary in your review settings.

@tg666
tg666 merged commit a6b05a7 into main Jan 30, 2026
8 of 9 checks passed
@tg666
tg666 deleted the feature/custom-http-middlewares branch January 30, 2026 03:57
@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The changes introduce HTTP middleware support to the AMP client by extending the Nette DI extension configuration schema to accept a list of middlewares, which are normalized to Statement objects and passed to HttpClientFactory for application to each created HTTP client.

Changes

Cohort / File(s) Summary
Middleware Configuration
CHANGELOG.md, src/Bridge/Nette/DI/AmpClientExtension.php, src/Bridge/Nette/DI/Config/HttpConfig.php
Added http.middlewares configuration option to DI extension schema as a list of strings or Statement objects, with normalization logic and property declaration in HttpConfig.
Middleware Implementation
src/Http/HttpClientFactory.php
Updated HttpClientFactory constructor to accept middlewares parameter, stores as private property, and applies them to each created HTTP client via aggregation into middleware chain.
Code Adjustments
src/Renderer/OutputBuffer.php, tests/Renderer/Latte/LatteRendererBridgeTest.php
Formatting reformatting of closure in OutputBuffer and comment-blocking of testNotFoundTemplateRendering method in test suite.

Sequence Diagram(s)

sequenceDiagram
    participant DI as DI Container
    participant Ext as AmpClientExtension
    participant Factory as HttpClientFactory
    participant Client as HttpClient

    DI->>Ext: Load configuration with http.middlewares
    Ext->>Ext: Normalize middlewares to Statement objects
    Ext->>Factory: Create with middlewares array
    Factory->>Factory: Store middlewares in property
    Note over Factory: When creating HTTP client
    Factory->>Factory: Iterate middlewares property
    Factory->>Factory: Aggregate into local chain via with()
    Factory->>Client: Build handler stack with middlewares
    Client->>Client: Execute request through middleware chain
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A hop and a skip through middleware configuration,
Statements and chains in fine orchestration!
The factory now crafts with elegant flair,
Each request dancing through middlewares with care! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/custom-http-middlewares

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 21503845150

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 8 of 11 (72.73%) changed or added relevant lines in 3 files are covered.
  • 6 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.3%) to 93.066%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Http/HttpClientFactory.php 2 3 66.67%
src/Bridge/Nette/DI/AmpClientExtension.php 4 6 66.67%
Files with Coverage Reduction New Missed Lines %
src/Renderer/Latte/LatteRendererBridge.php 6 40.0%
Totals Coverage Status
Change from base Build 19223269766: -0.3%
Covered Lines: 1530
Relevant Lines: 1644

💛 - Coveralls

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.

2 participants