Skip to content

Fix type bug in cors #37

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

Merged
merged 22 commits into from
Oct 23, 2020
Merged

Fix type bug in cors #37

merged 22 commits into from
Oct 23, 2020

Conversation

dbartholomae
Copy link
Owner

Closes #36

@CLAassistant
Copy link

CLAassistant commented Oct 23, 2020

CLA assistant check
All committers have signed the CLA.

This solves a type problem related to compose: TypeScript cannot infer generics of composited functions correctly, so we need to get rid of generics to make composition easier.

BREAKING CHANGE: Before, JsonSerializer middleware could be used for handler of all kinds of events. Now it can only be used for APIGatewayEvents. This should not cause much trouble, as the middleware already returned APIGatewayResponses only.
This solves a type problem related to compose: TypeScript cannot infer generics of composited functions correctly, so we need to get rid of generics to make composition easier.

BREAKING CHANGE: Before, ErrorHandler middleware could be used for handler of all kinds of events. Now it can only be used for APIGatewayEvents. This should not cause much trouble, as the middleware already returned APIGatewayResponses only.
This solves a type problem related to compose: TypeScript cannot infer generics of composited functions correctly, so we need to get rid of generics to make composition easier.

BREAKING CHANGE: Before, cors middleware could be used for handler of all kinds of events. Now it can only be used for APIGatewayEvents. This should not cause much trouble, as the middleware already returned APIGatewayResponses only.
This solves a type problem related to compose: TypeScript cannot infer generics of composited functions correctly, so we need to get rid of generics to make composition easier.

BREAKING CHANGE: Before, class-validator middleware could be used for handler of all kinds of events. Now it can only be used for APIGatewayEvents. This should not cause much trouble, as the middleware already depended on the body being in the same form as in an APIGatewayEvent.
@codecov
Copy link

codecov bot commented Oct 23, 2020

Codecov Report

Merging #37 into main will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #37   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           53        53           
  Lines          518       519    +1     
  Branches       102        98    -4     
=========================================
+ Hits           518       519    +1     
Impacted Files Coverage Δ
packages/class-validator/src/classValidator.ts 100.00% <100.00%> (ø)
packages/cors/src/cors.ts 100.00% <100.00%> (ø)
packages/http-error-handler/src/ErrorHandler.ts 100.00% <100.00%> (ø)
packages/json-serializer/src/JsonSerializer.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b73e993...52f035b. Read the comment docs.

@dbartholomae dbartholomae merged commit c6c763d into main Oct 23, 2020
@dbartholomae dbartholomae deleted the fix_type_bug_in_cors branch October 23, 2020 15:02
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.

Question - Composing multiple middleware
2 participants