Skip to content

Conversation

@DigitalBrainJS
Copy link
Collaborator

@DigitalBrainJS DigitalBrainJS commented Jun 14, 2022

Depends on #4772

  • Refactored sources, Mocha tests, Karma tests to use ES2017 & ESM;
  • Refactored tests structure;
  • Refactored dev scripts;
  • Grunt replaced with Gulp;
  • Webpack replaced with Rollup (for Karma tests);
  • A batch of minor refactorings of the dev environment;

Refactored accessor building routine;
Refactored default transforms;
Removed `normalizeHeaderName` helper;
Added missed `has` accessor to TS types;
Added progress capturing ability for node.js environment;
Added `maxRate` option to limit the data rate in node.js environment;
Refactored event handled by `onUploadProgress` && `onDownloadProgress` listeners in browser environment;
Added progress & data rate tests for the http adapter;
Added response stream aborting test;
Added a manual progress capture test for the browser;
Updated TS types;
Added TS tests;
Refactored request abort logic for the http adapter;
Added ability to abort the response stream;
� Conflicts:
�	lib/core/transformData.js
�	lib/defaults/index.js
�	lib/helpers/parseHeaders.js
�	lib/utils.js
…mption;

Added throwing an error if the request stream was silently destroying (without error) Refers to axios#3966;
Replaced grunt with gulp;
Improved dev scripts;
Added Babel for rollup build;
@jasonsaayman
Copy link
Member

@DigitalBrainJS please can you send me an email with your email address I would like to add you to our slack channel, this pr and another one in the works would make a lot of sense to pull together as one larger refactor. Thanks 😄

@jasonsaayman jasonsaayman merged commit bdf493c into axios:v1.x Jun 18, 2022
thebanjomatic added a commit to thebanjomatic/axios that referenced this pull request Jun 29, 2023
When axios#4787 was implemented, the project was switched to `"type": "module"` and "./index.js" became an esm file instead of commonjs, however, the "main" entry in package.json still points to "index.js". As a result, consumers using this field may get unexpected behavior since the main field is supposed to be commonjs if the entry is provided.

Many consumers won't run into this as a practical problem (for example when just doing `const axios = require('axios').default` from inside of a cjs file in node) because the "exports" map takes precedence over the main/module fields, but tools that don't parse the object map when resolving still run into problems here.

The fix for this is to just point the "main" entry-point to the commonjs artifacts located at "./dist/node/index.cjs".
thebanjomatic added a commit to thebanjomatic/axios that referenced this pull request Oct 5, 2023
When axios#4787 was implemented, the project was switched to `"type": "module"` and "./index.js" became an esm file instead of commonjs, however, the "main" entry in package.json still points to "index.js". As a result, consumers using this field may get unexpected behavior since the main field is supposed to be commonjs if the entry is provided.

Many consumers won't run into this as a practical problem (for example when just doing `const axios = require('axios').default` from inside of a cjs file in node) because the "exports" map takes precedence over the main/module fields, but tools that don't parse the object map when resolving still run into problems here.

The fix for this is to just point the "main" entry-point to the commonjs artifacts located at "./dist/node/index.cjs".
thebanjomatic added a commit to thebanjomatic/axios that referenced this pull request Oct 5, 2023
When axios#4787 was implemented, the project was switched to `"type": "module"` and "./index.js" became an esm file instead of commonjs, however, the "main" entry in package.json still points to "index.js". As a result, consumers using this field may get unexpected behavior since the main field is supposed to be commonjs if the entry is provided.

Many consumers won't run into this as a practical problem (for example when just doing `const axios = require('axios').default` from inside of a cjs file in node) because the "exports" map takes precedence over the main/module fields, but tools that don't parse the object map when resolving still run into problems here.

The fix for this is to just point the "main" entry-point to the commonjs artifacts located at "./dist/node/index.cjs".

I also added a module entrypoint to improve compatability for the cases where the export map is not used (webpack 4 for example) since that would likely be reading the cjs "main" entrypoint now that main has switched back to cjs.
ckng0221 added a commit to ckng0221/axios that referenced this pull request Nov 11, 2023
As grunt devDependencies were already remove in axios#4787, change the
grunt related CLI run, including `grunt build` and `grunt test` to
`npm run test` and `npm run build`.

Refs: axios#4787
ebeigarts added a commit to ebeigarts/axios that referenced this pull request Oct 13, 2025
…d and maxRedirects is set to 0

The axios request is left in an unsettled state (waits forever) when using compression
and maxRedirects is set to 0 and the request gets aborted after some chunks are sent.

The problem is that the response `abort` event is not being emitted and the request state
inside the `responseStream.on('error')` callback is `destroyed: true, aborted: false`.

I see that previoysly axios was checking `req.aborted` instead of `req.destroyed` inside
the `responseStream.on('error')` callback, but since node deprecated the `req.aborted`, it was
changed to `req.destroyed` in axios#4787.

We could change that back to `req.aborted`, but I think checking `rejected` would be
a better option, so we can be sure that we are catching all the errors
(in case there are some more weird cases).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants