mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 12:57:46 +00:00
There are times when a request can arrive for a Python function with headers as a list. One of those examples is this header `x-vercel-proxied-for` which apparently is set twice. Example: `[b'x-vercel-proxied-for', [b'207.81.134.243', b'172.71.147.74']]` I took a quick scan through the other Python server implementations and I don't think any of them manipulate the value of the HTTP headers, the way the ASGI one does so I think we are good there. To reproduce: `curl https://..../ -H "foo: bar" -H "foo: bar"` Will fail. Fixes: https://github.com/vercel/vercel/issues/9132
19 lines
432 B
JavaScript
19 lines
432 B
JavaScript
const execa = require('execa');
|
|
|
|
module.exports = async function ({ deploymentUrl, fetch }) {
|
|
const probeUrl = `https://${deploymentUrl}`;
|
|
const result = await execa('curl', [
|
|
probeUrl,
|
|
'-s',
|
|
'-H',
|
|
'foo: bar',
|
|
'-H',
|
|
'foo: bar',
|
|
]);
|
|
if (result.stdout.includes('FUNCTION_INVOCATION_FAILED')) {
|
|
throw new Error(
|
|
'Duplicate headers should not cause a function invocation failure'
|
|
);
|
|
}
|
|
};
|