This repository has been archived on 2024-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
svrjs-blog-newsletter/cronjob/node_modules/@smithy/middleware-retry/dist-es/omitRetryHeadersMiddleware.js

23 lines
847 B
JavaScript
Raw Permalink Normal View History

2024-05-26 22:54:55 +02:00
import { HttpRequest } from "@smithy/protocol-http";
import { INVOCATION_ID_HEADER, REQUEST_HEADER } from "@smithy/util-retry";
export const omitRetryHeadersMiddleware = () => (next) => async (args) => {
const { request } = args;
if (HttpRequest.isInstance(request)) {
delete request.headers[INVOCATION_ID_HEADER];
delete request.headers[REQUEST_HEADER];
}
return next(args);
};
export const omitRetryHeadersMiddlewareOptions = {
name: "omitRetryHeadersMiddleware",
tags: ["RETRY", "HEADERS", "OMIT_RETRY_HEADERS"],
relation: "before",
toMiddleware: "awsAuthMiddleware",
override: true,
};
export const getOmitRetryHeadersPlugin = (options) => ({
applyToStack: (clientStack) => {
clientStack.addRelativeTo(omitRetryHeadersMiddleware(), omitRetryHeadersMiddlewareOptions);
},
});