function createServerResponse(
	id,
	{
		onChunk = (chunk, encoding) => {
			parentPort?.postMessage(
				JSON.stringify({
					chunk: new TextDecoder().decode(chunk),
					id,
				}),
			);
		},
		onHeader = (header, value) => {
			parentPort?.postMessage(
				JSON.stringify({
					chunk: "$header",
					data: {
						key: header,
						value,
					},
					id,
				}),
			);
		},
		onFinish = () => {
			parentPort?.postMessage(
				JSON.stringify({
					chunk: "end",
					id,
				}),
			);
		},
	},
) {
	const responseHeaders = {};
	const writableStream = new Writable({
		write(chunk, encoding, callback) {
			onChunk(chunk);
			callback();
		},
	});
	writableStream.socket = {};
	writableStream.getHeader = (header) => {
		return responseHeaders[header];
	};
	writableStream.setHeader = (header, value) => {
		responseHeaders[header] = value;
		onHeader(header, value);
	};

	writableStream.on("finish", () => {
		onFinish();
	});
	return writableStream;
}
@param {string} id
@returns {import('node:http').ServerResponse}