Skip to content

Commit

Permalink
Fix(service-connector): async header interceptors
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Feb 8, 2024
1 parent 0bedb86 commit 278033e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/service-connector/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { formatLogs, coloredString } from "./helpers";
const serviceConnector = ({ service, headerIntercepts, loggable, logs = true, ...axiosOptions } = {}) => {
const logger = moduleLogger(chalk.bold(service ?? "Service-Connector"));
const instance = axios.create(axiosOptions);
instance.interceptors.request.use((config) => {
instance.interceptors.request.use(async (config) => {
logs &&
logger.info(
`Request initiated - ${coloredString("method")}: ${coloredString(config.method)} - ${coloredString(
Expand All @@ -20,7 +20,7 @@ const serviceConnector = ({ service, headerIntercepts, loggable, logs = true, ..
if (headerIntercepts) {
config.headers = {
...config.headers,
...headerIntercepts(config)
...(await headerIntercepts(config))
};
}
return config;
Expand Down

0 comments on commit 278033e

Please sign in to comment.