2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

fix: unclear error message is thrown when specifying an empty proxy authorization (#6314)

* fix: add AxiosError to Invalid proxy authorization

* fix: minor update

* Update test/unit/adapters/http.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: remove redundant check

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: code style

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: style

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: correct assert

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: João Gabriel Quaresma de Almeida <joaoGabriel55>
Co-authored-by: Jay <jasonsaayman@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Gabriel Quaresma
2025-11-12 16:04:39 -03:00
committed by GitHub
parent 15bf9563f6
commit 6ef867e684
2 changed files with 31 additions and 4 deletions
+23
View File
@@ -1361,6 +1361,29 @@ describe('supports http with nodejs', function () {
});
});
describe('when invalid proxy options are provided', function () {
it('should throw error', function () {
const proxy = {
protocol: "http:",
host: "hostname.abc.xyz",
port: 3300,
auth: {
username: "",
password: "",
}
};
return axios.get('https://test-domain.abc', {proxy})
.then(function(){
assert.fail('Does not throw');
}, function (error) {
assert.strictEqual(error.message, 'Invalid proxy authorization');
assert.strictEqual(error.code, 'ERR_BAD_OPTION');
assert.deepStrictEqual(error.config.proxy, proxy);
})
});
});
context('different options for direct proxy configuration (without env variables)', () => {
const destination = 'www.example.com';