Custom properties for config
See original GitHub issueSo, if I understand it right, in 0.19.0 you’ve added mergeConfig
And this function filter config and remove custom properties from it.
It broke my solution for cancellation:
How it works:
const requestManager = new RequestManager();
const instance = axios.create();
requestManager.patchAxiosInstance(instance);
const search = q =>
instance.get('/search', {
cancelable: true, // this is no longer possible in 0.19.0
params: { q },
});
The solution:
class RequestManager {
constructor() {
this.pendingRequests = new Map();
}
patchAxiosInstance(instance) {
instance.interceptors.request.use(config => {
if (!config.cancelable) return config; // this is no longer possible in 0.19.0
const source = axios.CancelToken.source();
const requestId = `${config.method}_${config.url}`;
const cancelToken = source.token;
this.addRequest(requestId, source.cancel);
return { ...config, cancelToken, requestId };
});
instance.interceptors.response.use(response => {
const { requestId } = response.config; // this is no longer possible in 0.19.0
if (requestId) {
this.removeRequest(requestId);
}
return response;
});
}
addRequest(requestId, cancelFn) {
this.cancelRequest(requestId);
this.pendingRequests.set(requestId, cancelFn);
}
removeRequest(requestId) {
this.pendingRequests.delete(requestId);
}
cancelRequest(requestId) {
if (this.pendingRequests.has(requestId)) {
const cancelFn = this.pendingRequests.get(requestId);
cancelFn();
this.removeRequest(requestId);
}
}
}
So, is it possible to relax filter in mergeConfig
for custom properties? Because sometimes it is needed and very helpful in interceptors or somewhere else.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:42
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Custom Properties in Configurations - SolidWorks Web Help
where property is the name of a custom property. You can use one of the custom properties listed in the Summary Information dialog...
Read more >Custom Configuration Properties Provider
You can use the Mule SDK and Mule API to create a custom configuration properties provider that enables an app to discover configuration...
Read more >Guide to @ConfigurationProperties in Spring Boot - Baeldung
Spring Boot has many useful features including externalized configuration and easy access to properties defined in properties files.
Read more >Custom properties for devices - Configuration Manager
Set properties via UI · In the Configuration Manager console, go to the Assets and Compliance workspace, and select the Devices node. ·...
Read more >Configuring custom properties to secure web services - IBM
Configuring custom properties to secure web services. You can configure name-value pairs of data, where the name is a property key and the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it refusing me too, this bug still exists since axios stays at version 0.19.0.
This is still very much a bug/issue that should remain open, I agree with @someden - until this is released to npm, it is not useful for any consumers of the package to have this ticket closed.