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

HBRouteHandler cleanup #332

Merged
merged 2 commits into from
Jan 7, 2024
Merged

HBRouteHandler cleanup #332

merged 2 commits into from
Jan 7, 2024

Conversation

adam-fowler
Copy link
Member

@adam-fowler adam-fowler commented Jan 5, 2024

  • handle method only gets the context as it is assumed you have extracted all you need from the request in init
  • Removed HBRequestDecodable as soon as that was released I hated it.
  • correct comment

Not sure if I'll keep the route handlers as it is hard to do dependency injection with them. But for the moment I've cleaned up everything a little

I also changed HBRequest.decode(as:using) to HBRequest.decode(as:context). I don't use using to pass the context around anyway else. It is always context. This change went in here as it clashed with the rest of this PR

@adam-fowler adam-fowler requested a review from Joannis January 5, 2024 16:25
Copy link

codecov bot commented Jan 5, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (48371bc) 83.13% compared to head (ddc3243) 83.10%.

Files Patch % Lines
Sources/Hummingbird/Router/RouteHandler.swift 66.66% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            2.x.x     #332      +/-   ##
==========================================
- Coverage   83.13%   83.10%   -0.04%     
==========================================
  Files          92       91       -1     
  Lines        5009     5006       -3     
==========================================
- Hits         4164     4160       -4     
- Misses        845      846       +1     

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

Copy link

github-actions bot commented Jan 5, 2024

@Joannis
Copy link
Member

Joannis commented Jan 6, 2024

@adam-fowler I like removing HBRequestDecodable, and understand removing the request from handle. But since init also gets the context, shouldn't we remove that from handle as well?

@adam-fowler
Copy link
Member Author

@adam-fowler I like removing HBRequestDecodable, and understand removing the request from handle. But since init also gets the context, shouldn't we remove that from handle as well?

Then people would have to store things like the logger and allocator in the route handler

Copy link
Member

@Joannis Joannis left a comment

Choose a reason for hiding this comment

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

I'm not sure what to think of the remaining issue I've brought up, but this improvement is already a welcome one. Should we make an discussion topic/issue of my comment?

@adam-fowler
Copy link
Member Author

I'm not sure what to think of the remaining issue I've brought up, but this improvement is already a welcome one. Should we make a discussion topic/issue of my comment?

Yeah add an issue

@adam-fowler adam-fowler merged commit b323d71 into 2.x.x Jan 7, 2024
2 of 5 checks passed
@adam-fowler adam-fowler deleted the route-handler branch January 7, 2024 21:53
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