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

docs: refactor "Custom Middleware" guide #3833

Merged
merged 2 commits into from
Oct 19, 2024
Merged

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Oct 19, 2024

Link: https://docs.litestar.dev/latest/usage/middleware/creating-middleware.html

Changes:

  • I removed super().__init__ call for Protocol, it should not happen by definition, because Protocol cannot have any implementation in __init__
  • I used time.monotonic for timing examples, because it is more fitting for the job, I can use perf_counter instead if you wish
  • I removed several if TYPE_CHECKING blocks, because they made examples more complex to read with no real need
  • logger.info should be lazy in terms of string format, not eager
  • ~ usage, where possible
  • exclude_from_middleware -> exclude_from_my_middleware, because it was not clear if this name was special or not. Now it is clear that it is a user defined name.

And other small fixes here and there :)

@sobolevn sobolevn requested review from a team as code owners October 19, 2024 09:49
@github-actions github-actions bot added area/docs This PR involves changes to the documentation size: small type/docs pr/external Triage Required 🏥 This requires triage labels Oct 19, 2024
@provinzkraut provinzkraut enabled auto-merge (squash) October 19, 2024 09:54
@provinzkraut provinzkraut merged commit b2adb0d into main Oct 19, 2024
24 checks passed
@provinzkraut provinzkraut deleted the custom-middleware-docs branch October 19, 2024 09:55
Copy link

sonarcloud bot commented Oct 19, 2024

Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3833

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs This PR involves changes to the documentation pr/external size: small Triage Required 🏥 This requires triage type/docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants