Skip to content
This repository was archived by the owner on Oct 7, 2022. It is now read-only.

Commit fa9dab1

Browse files
committed
remove undefined header values + export debug
1 parent d434d5e commit fa9dab1

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

dist/axios.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ export default async function(step: any, config) {
2929
}
3030
*/
3131
async function default_1(step, config) {
32-
return (await axios_1.default(config)).data;
32+
// XXX warn about mutating config object... or clone?
33+
for (const k in config.headers || {}) {
34+
if (typeof config.headers[k] === "undefined") {
35+
delete config.headers[k];
36+
}
37+
}
38+
try {
39+
return (await axios_1.default(config)).data;
40+
}
41+
catch (err) {
42+
this.debug = err.response;
43+
throw err;
44+
}
3345
}
3446
exports.default = default_1;

lib/axios.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,16 @@ export default async function(step: any, config) {
2929
*/
3030

3131
export default async function(step: any, config) {
32-
return (await axios(config)).data
32+
// XXX warn about mutating config object... or clone?
33+
for (const k in config.headers || {}) {
34+
if (typeof config.headers[k] === "undefined") {
35+
delete config.headers[k]
36+
}
37+
}
38+
try {
39+
return (await axios(config)).data
40+
} catch (err) {
41+
this.debug = err.response
42+
throw err
43+
}
3344
}

0 commit comments

Comments
 (0)