diff --git a/src/utils/serve-functions.js b/src/utils/serve-functions.js index e31963ea9d0..b2c2c8d26b6 100644 --- a/src/utils/serve-functions.js +++ b/src/utils/serve-functions.js @@ -293,6 +293,7 @@ function createFormSubmissionHandler(siteInfo) { async function serveFunctions(dir, siteInfo = {}) { const app = express() + app.set('query parser', 'simple') app.use( bodyParser.text({ diff --git a/tests/dev.test.js b/tests/dev.test.js index 054ef31992d..b197c0968a2 100644 --- a/tests/dev.test.js +++ b/tests/dev.test.js @@ -153,6 +153,12 @@ test('functions: not found', async t => { t.is(response.status, 404) }) +test('functions: query parameters parsing', async t => { + const response = await fetch(`http://${host}/api/echo?category[SOMETHING][]=something`).then(r => r.json()) + + t.deepEqual(response.queryStringParameters, { 'category[SOMETHING][]': 'something' }) +}) + test('Netlify Forms support', async t => { const form = new FormData() form.append('some', 'thing')