stop messing up API client headers in requests to backend (#28)
This commit is contained in:
parent
562ddafb4b
commit
5dc5ef6baa
12
src/main.ts
12
src/main.ts
|
@ -124,18 +124,10 @@ async function postWithRetryToBlacksmithAPI(client: AxiosInstance, url: string,
|
||||||
|
|
||||||
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
||||||
try {
|
try {
|
||||||
const headers = {
|
|
||||||
...client.defaults.headers.common,
|
|
||||||
Accept: 'application/json',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
};
|
|
||||||
|
|
||||||
core.debug(`Making POST request to ${url}`);
|
core.debug(`Making POST request to ${url}`);
|
||||||
core.debug(`Request headers: ${JSON.stringify(headers, null, 2)}`);
|
core.debug(`Request headers: ${JSON.stringify(client.defaults.headers, null, 2)}`);
|
||||||
|
|
||||||
return await client.post(url, JSON.stringify(requestOptions), {
|
return await client.post(url, requestOptions);
|
||||||
headers
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (attempt === maxRetries || !retryCondition(error as AxiosError)) {
|
if (attempt === maxRetries || !retryCondition(error as AxiosError)) {
|
||||||
throw error;
|
throw error;
|
||||||
|
|
Loading…
Reference in New Issue