Feature: Add request hooks#36
Conversation
|
@igoroctaviano this is super cool, but not easy to understand: const pipe = functions => args => functions.reduce((arg, fn) => fn(arg), args)If we go for this approach, I would suggest adding
|
|
Yes, and while we need to be idiomatic to the languages, it would be great if the functionality and perhaps even some of the naming were consistent with the discussion here: |
| if (requestInterceptors) { | ||
| console.debug('yes') | ||
| const metadata = { method, url }; | ||
| const pipeRequestInterceptors = functions => (args) => functions.reduce((args, fn) => fn(args, metadata), args); |
There was a problem hiding this comment.
I would suggest adding a couple of runtime checks here
There was a problem hiding this comment.
Updated. Let me know if I should add more. Thanks.
|
@igoroctaviano could we call the option |
Sure, I took it from axios library, where they call these request interceptors but I'm fine with hooks, updated. |
|
@hackermd just pushed an example and updated the existent one to point to dcmjs server. |
|
It needs to be rebased but otherwise is this ready to be merged? |
Yes, just waiting review + merge. |
|
Any further comments @hackermd or should we merge? |
hackermd
left a comment
There was a problem hiding this comment.
Looks great @igoroctaviano! Just a few minor comments/suggestions. Feel free to ignore.
|
@pieper can you please merge this? Thanks! |
@Punzo @igoroctaviano I merged the PR. Let me know if we should draft a new release. |
yes, please! thanks! |
|
@Punzo @igoroctaviano I released version 0.8.0 (https://github.com/dcmjs-org/dicomweb-client/releases/tag/v0.8.0) and uploaded the new version of the package to npm (https://www.npmjs.com/package/dicomweb-client/v/0.8.0) |
Example using node-retry to add retry functionality to XHR: