//#region src/domains/run/utils/merge-headers.ts
function mergeHeadersWithoutOverrides(existingHeaders, forwardedHeaders) {
	const mergedHeaders = { ...existingHeaders || {} };
	const existingHeaderNames = new Set(Object.keys(mergedHeaders).map((header) => header.toLowerCase()));
	for (const [headerName, headerValue] of Object.entries(forwardedHeaders)) {
		if (existingHeaderNames.has(headerName.toLowerCase())) continue;
		mergedHeaders[headerName] = headerValue;
	}
	return mergedHeaders;
}

//#endregion
export { mergeHeadersWithoutOverrides };