Skip to content

Commit

Permalink
Patch(service-connector): updated request interceptor handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Feb 8, 2024
1 parent 278033e commit 682dd5a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/service-connector/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ const serviceConnector = ({ service, headerIntercepts, loggable, logs = true, ..
);
config.headers["x-correlation-id"] = context.get("correlationId");
if (headerIntercepts) {
let intercepts = headerIntercepts(config);
if (intercepts instanceof Promise)
intercepts = await intercepts.catch((e) => logger.error("Failed to intercept headers", e));
config.headers = {
...config.headers,
...(await headerIntercepts(config))
...intercepts
};
}
return config;
Expand Down

0 comments on commit 682dd5a

Please sign in to comment.