-
-
Notifications
You must be signed in to change notification settings - Fork 758
feat: add new dispatch compose #2826
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
Changes from 23 commits
560d35b
5337ea0
8019e59
1d54170
051caa1
b45ecad
9048eb5
7656e1b
9f0631e
5588a1d
04c8acb
8ac252d
8c8c064
9d1a6c0
0fd9ea7
53f4cfa
6580d84
1d987a2
d66530f
b932ad2
20d3a33
2d59acc
2f5982e
eb065f7
620f9bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| 'use strict' | ||
| const ProxyAgent = require('../dispatcher/proxy-agent') | ||
|
|
||
| module.exports = opts => { | ||
| const agent = new ProxyAgent(opts) | ||
| return dispatch => { | ||
| dispatch = agent.dispatch.bind(agent) | ||
|
|
||
| return dispatch | ||
| } | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't an interceptor?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's what I was referring to when I suggested that I couldn't think of any other way without re-working the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will have to investigate this
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It sounds to me like this should not be an interceptor.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's skip this for now so we can land. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| 'use strict' | ||
| const RedirectHandler = require('../handler/redirect-handler') | ||
|
|
||
| module.exports = opts => { | ||
| const globalMaxRedirections = opts?.maxRedirections | ||
| return dispatch => { | ||
| return function redirectInterceptor (opts, handler) { | ||
|
ronag marked this conversation as resolved.
|
||
| const { maxRedirections = globalMaxRedirections, ...baseOpts } = opts | ||
|
|
||
| if (!maxRedirections) { | ||
| return dispatch(opts, handler) | ||
| } | ||
|
|
||
| const redirectHandler = new RedirectHandler( | ||
| dispatch, | ||
| maxRedirections, | ||
| opts, | ||
| handler | ||
| ) | ||
|
|
||
| return dispatch(baseOpts, redirectHandler) | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| 'use strict' | ||
| const RetryHandler = require('../handler/retry-handler') | ||
|
|
||
| module.exports = globalOpts => { | ||
| return dispatch => { | ||
| return function retryInterceptor (opts, handler) { | ||
| return dispatch( | ||
| opts, | ||
| new RetryHandler( | ||
| { ...opts, retryOptions: { ...globalOpts, ...opts.retryOptions } }, | ||
| { | ||
| handler, | ||
| dispatch | ||
| } | ||
| ) | ||
| ) | ||
| } | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.