@softchef/cdk-iot-device-management
Version:
IoT device management is composed of things, thing types, thing groups, jobs, files API services. The constructs can be used independently, that are based on full-managed service to create an API Gateway & Lambda function.
30 lines (29 loc) • 939 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.headerDefault = void 0;
const protocol_http_1 = require("@aws-sdk/protocol-http");
function headerDefault(headerBag) {
return (next) => {
return (args) => {
if (protocol_http_1.HttpRequest.isInstance(args.request)) {
const headers = { ...args.request.headers };
for (const name of Object.keys(headerBag)) {
if (!(name in headers)) {
headers[name] = headerBag[name];
}
}
return next({
...args,
request: {
...args.request,
headers,
},
});
}
else {
return next(args);
}
};
};
}
exports.headerDefault = headerDefault;