-
Notifications
You must be signed in to change notification settings - Fork 60
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
it's not working with axios v.19.0 #62
Comments
Yes, the reason for that is – as @adntin points out here – that Axios 0.19 filters out custom properties. |
Yeah - sadly I doubt I'm going to be updating this library to support the latest version 😢 We just don't use this at my company anymore, so I don't have a ton of time to keep it up to date. If others are interested ... I'd happily accept PRs! |
fyi: We just fixed this by using the same meachanism, but using a custom header field instead of the custom config property. |
This is kind of janky but you can patch axios 0.19 directly in node_modules to permit Patch: diff --git a/node_modules/axios/lib/core/mergeConfig.js b/node_modules/axios/lib/core/mergeConfig.js
index 6097a3e..1ec151e 100644
--- a/node_modules/axios/lib/core/mergeConfig.js
+++ b/node_modules/axios/lib/core/mergeConfig.js
@@ -38,7 +38,7 @@ module.exports = function mergeConfig(config1, config2) {
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
- 'socketPath'
+ 'socketPath', 'raxConfig'
], function defaultToConfig2(prop) {
if (typeof config2[prop] !== 'undefined') {
config[prop] = config2[prop]; then in your package.json: "postintall": "patch -p1 -N < /axios-config-fix.patch", |
@dennisreimann Hi please can you demonstrate how you managed to fix this? |
@KayHS see this comment. Whereas before you have assigned the property directly to the config (i.e. |
hnn, my setup is like the following
so headers.common['raxConfig'] = retryConfig? |
Or something like this: headers: {
"X-ID": classificationRequest.id,
"x-retry-count": 0
}, It does not really matter, as long as you write to the same header property you also read from. |
or you can use the master version on git |
Tried it and It's working, also with other NPM libraries for retries. Thanks a lot. |
You can apply the patch using |
@DanielRuf it looks like |
In our project it didn't work with the custom options. Headers might work but I chose the normal solution from the docs. |
I will check that again. But we pinned the version. |
Seems to be fixed in 0.19.1 but we'll still apply the patch to ensure that it will work. |
Awesome. Seems like it's working, so I'm closing this out :) |
it's not working with axios v.19.0
The text was updated successfully, but these errors were encountered: