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

Generic request decoder and response encoder #353

Merged
merged 2 commits into from
Jan 19, 2024
Merged

Conversation

adam-fowler
Copy link
Member

Instead of requiring we store a request decoder and response encoder in the core context. This PR makes them accessible from the root of HBRequestContext. This allows us to make them to be generic and not existential types.

It does mean we have to get rid of HBSetCodableMiddleware, but I think making these generic is a bigger gain.

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

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

Comparison is base (9f245ce) 83.73% compared to head (e7b13de) 83.63%.

Files Patch % Lines
Sources/Hummingbird/Server/RequestContext.swift 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            2.x.x     #353      +/-   ##
==========================================
- Coverage   83.73%   83.63%   -0.10%     
==========================================
  Files          93       92       -1     
  Lines        5059     5047      -12     
==========================================
- Hits         4236     4221      -15     
- Misses        823      826       +3     

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

Copy link
Contributor

@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.

One small possible improvement - if it's helpful

Comment on lines +64 to +65
associatedtype Decoder: HBRequestDecoder = NullDecoder
associatedtype Encoder: HBResponseEncoder = NullEncoder
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to make these primary associated types?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure that is necessary. When are you going to need to specify the encoder in a parameter type

Comment on lines +64 to +65
associatedtype Decoder: HBRequestDecoder = NullDecoder
associatedtype Encoder: HBResponseEncoder = NullEncoder
Copy link
Contributor

Choose a reason for hiding this comment

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

This will need fixing in HBLambda

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, PR on its way

@adam-fowler adam-fowler merged commit 1cbed05 into 2.x.x Jan 19, 2024
2 of 5 checks passed
@adam-fowler adam-fowler deleted the generic-coders branch January 19, 2024 15:23
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.

None yet

2 participants