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

refactor(http): eagerly loaded HttpOutputEffect and HttpErrorEffect #357

Merged
merged 4 commits into from
Aug 26, 2021

Conversation

JozefFlakus
Copy link
Member

@JozefFlakus JozefFlakus commented Aug 24, 2021

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[x] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Current HTTP effect I/O flow:

1. HttpMiddlewareEffect
Observable<req> -> Observable<req>

2. HttpEffect
Observable<req> -> Observable<{ status, body, headers }>
Observable<req> -> Observable<{ status, body, headers, request }>

3. HttpOutputEffect  ## here is the inconsistency 👇 
Observable<{ req, res: { status, body, headers } }> -> Observable<{ status, body, headers }>

4. HttpErrorEffect  ## here is the inconsistency 👇 
Observable<{ req, error }> -> Observable<{ status, body, headers }>

What is the new behavior?

  • @marblejs/http - HttpOutputEffect's and HttpErrorEffects are resolved eagerly during initial bootstrap (optimized request/response processing)
  • @marblejs/http - HttpOutputEffect interface change
  • @marblejs/http - HttpErrorEffect interface change

HTTP effect I/O flow after the change:

1. HttpMiddlewareEffect
Observable<req> -> Observable<req>

2. HttpEffect
Observable<req> -> Observable<{ status, body, headers }>
Observable<req> -> Observable<{ status, body, headers, response }>

3. HttpOutputEffect  ## 👇 
Observable<{ status, body, headers, request }> -> Observable<{ status, body, headers, request }>

4. HttpErrorEffect ## 👇 
Observable<{ error, request }> -> Observable<{ status, body, headers, request }>

Does this PR introduce a breaking change?

[x] Yes
[ ] No

@JozefFlakus JozefFlakus added enhancement New feature or request next Feature or enhancement that will be added in 'next' major version scope: http Relates to @marblejs/http package labels Aug 24, 2021
@JozefFlakus JozefFlakus added this to the 4.0 milestone Aug 24, 2021
@JozefFlakus JozefFlakus self-assigned this Aug 24, 2021
@codecov
Copy link

codecov bot commented Aug 24, 2021

Codecov Report

Merging #357 (b012be6) into next (46befd6) will decrease coverage by 0.70%.
The diff coverage is 93.37%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next     #357      +/-   ##
==========================================
- Coverage   94.91%   94.21%   -0.71%     
==========================================
  Files         135      159      +24     
  Lines        2242     3092     +850     
  Branches      301      353      +52     
==========================================
+ Hits         2128     2913     +785     
- Misses        110      175      +65     
  Partials        4        4              
Impacted Files Coverage Δ
packages/core/src/logger/logger.interface.ts 100.00% <ø> (ø)
packages/core/src/operators/use/use.operator.ts 50.00% <ø> (-50.00%) ⬇️
packages/http/src/http.interface.ts 100.00% <ø> (ø)
packages/http/src/index.ts 0.00% <0.00%> (ø)
packages/http/src/router/http.router.matcher.ts 100.00% <ø> (ø)
...messaging/src/transport/strategies/tcp.strategy.ts 0.00% <0.00%> (ø)
packages/middleware-cors/src/applyHeaders.ts 100.00% <ø> (ø)
packages/middleware-cors/src/checkOrigin.ts 100.00% <ø> (ø)
packages/middleware-cors/src/configureResponse.ts 100.00% <ø> (ø)
packages/middleware-cors/src/index.ts 100.00% <ø> (ø)
... and 164 more

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 6973ec5...b012be6. Read the comment docs.

@JozefFlakus JozefFlakus changed the title refactor(http): eagerly loaded HttpOutputEffect refactor(http): eagerly loaded HttpOutputEffect and HttpErrorEffect Aug 24, 2021
@JozefFlakus JozefFlakus force-pushed the refactor/http/lazy-loaded-effects branch from cc6c08e to ac03ca9 Compare August 24, 2021 12:37
@JozefFlakus JozefFlakus force-pushed the refactor/http/lazy-loaded-effects branch from 4d0290f to b012be6 Compare August 26, 2021 09:03
@JozefFlakus JozefFlakus merged commit 60584e1 into next Aug 26, 2021
@JozefFlakus JozefFlakus deleted the refactor/http/lazy-loaded-effects branch August 26, 2021 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request next Feature or enhancement that will be added in 'next' major version scope: http Relates to @marblejs/http package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants