2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00
Files
axios/tests/unit/helpers/resolveConfig.test.js
T
Rayan Salhab 7b3369a9c4 fix: clear RN FormData content type (#10898)
* fix: clear RN FormData content type

* docs: add React Native FormData release note

---------

Co-authored-by: cyphercodes <cyphercodes@users.noreply.github.com>
Co-authored-by: Jason Saayman <jasonsaayman@gmail.com>
2026-05-24 15:39:00 +02:00

36 lines
838 B
JavaScript

import { describe, it } from 'vitest';
import assert from 'assert';
import resolveConfig from '../../../lib/helpers/resolveConfig.js';
class ReactNativeFormData {
append() {}
getParts() {
return [];
}
get [Symbol.toStringTag]() {
return 'FormData';
}
}
describe('helpers::resolveConfig', () => {
it('clears Content-Type for React Native FormData', () => {
const data = new ReactNativeFormData();
const config = resolveConfig({
url: '/upload',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
assert.strictEqual(config.data, data);
assert.strictEqual(config.headers.getContentType(), undefined);
assert.strictEqual(
Object.prototype.hasOwnProperty.call(config.headers.toJSON(), 'Content-Type'),
false
);
});
});