transformResponse docs misleading
See original GitHub issueI’ve recently used transformRequest to get rid of the Authorization header. It took me a while to get the correct way to pass on the data. Documentation says:
// `transformResponse` allows changes to the response data to be made before
// it is passed to then/catch
transformResponse: [function (data) {
// Do whatever you want to transform the data
return data;
}],
but if you use this exact code the data are passed in a wrong format (a list with an object). At last I used:
transformResponse: [function (data) {
delete headers.common.Authorization
return JSON.stringify(data)
return data;
}],
I’m definitely a beginner in this specific field but I found the documentation misleading and if what I ended up doing is correct I’d appreciate the documentation to be updated.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:9 (1 by maintainers)
Top Results From Across the Web
React Toolkit Query - How to use transformResponse props ...
I have a root API where I am injecting endpoints. But when I try to add a transform function it doesn't work. From...
Read more >draft-ietf-httpbis-cache-17
This document may contain material from IETF Documents or IETF Contributions ... The "no-transform" response directive indicates that an ...
Read more >Deprecated List (Atlassian Confluence 7.3.5 API)
since 7.0 This query is redundant, misleading. ... since 6.10.0. Use PageResponseImpl.transformResponse(PageResponse, Function) instead.
Read more >emmeans: Estimated Marginal Means, aka Least-Squares ...
CLDs are misleading because they visually group means with comparisons P > alpha as though they are equal, when in fact we have...
Read more >What's New - Product Documentation Center
Dropping Support for SuSe Linux 12 SP2 ◾ Python 3.8 Syntax ◾ Required Upgrade to MSC Licensing Helium as of Adams 2020.0 ◾...
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
No results found
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
@sandroden The following code overrides default axios
transformResponse
array of functions.If you want to add your own
transformResponse
function, then do not override the whole array. Just preppend your function to that array using this code:The whole magic is in
...axios.defaults.transformRequest
Not the perfect solution, but i managed to bypass the error doing something like this: