Rocky_Mountain_Vending/.pnpm-store/v10/files/80/7773bb26a46361f4151d8800a68d310dc9ed3e635e17fb2ec6db2d3fac064c2269650cf374e1ae39c3afeaa96d21bb07cdb4535f7fcae9c745977cb9757af3
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

39 lines
1.3 KiB
Text

import { HttpRequest } from "@smithy/protocol-http";
const CONTENT_LENGTH_HEADER = "content-length";
export function contentLengthMiddleware(bodyLengthChecker) {
return (next) => async (args) => {
const request = args.request;
if (HttpRequest.isInstance(request)) {
const { body, headers } = request;
if (body &&
Object.keys(headers)
.map((str) => str.toLowerCase())
.indexOf(CONTENT_LENGTH_HEADER) === -1) {
try {
const length = bodyLengthChecker(body);
request.headers = {
...request.headers,
[CONTENT_LENGTH_HEADER]: String(length),
};
}
catch (error) {
}
}
}
return next({
...args,
request,
});
};
}
export const contentLengthMiddlewareOptions = {
step: "build",
tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"],
name: "contentLengthMiddleware",
override: true,
};
export const getContentLengthPlugin = (options) => ({
applyToStack: (clientStack) => {
clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions);
},
});