fix: stop pass through request params for function redirects
๐ Thanks for submitting a pull request! ๐
Summary
Fixes #4273
Query parameters specified in function redirects are not being passed (they're over-written by the request parameters) by netlify dev. This is different from currently observed production behaviour.
This is due to an intentional change in https://github.com/netlify/cli/issues/1605 to match the production behaviour at that time.
Difference b/w current local & production behaviour can be verified with the minimal reproduction & production deploy link below:
Minimal reproduction of the issue: https://github.com/KK-Learning-Gym/4273-with-fn (see netlify.toml)
Production Deploy: https://with-fn-testing.netlify.app
Quick Links:
Redirect with config from the updated test in this PR:
https://with-fn-testing.netlify.app/api/test?foo=1&foo=2&bar=1&bar=2
Redirects to
/.netlify/functions/echo?a=1&a=2 on production
/.netlify/functions/echo?foo=1&foo=2&bar=1&bar=2 locally
Redirect with config mentioned in #4273 on production:
https://with-fn-testing.netlify.app/.netlify/functions/bar/?url=bar
Redirects to
.netlify/functions/bar/?url=bar on production
.netlify/functions/bar/?url= locally
Also see https://github.com/netlify/cli/issues/4273#issuecomment-1070752142
This PR attempts to resolve the differences described above b/w netlify dev & production.
For us to review and ship your PR efficiently, please perform the following steps:
- [x] Open a bug/issue before writing your code ๐งโ๐ป. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire ๐ฅ (e.g. incident related), you can skip this step.
- [x] Read the contribution guidelines ๐. This ensures your code follows our style guide and passes our tests.
- [x] Update or add tests (if any source code was changed or added) ๐งช
- [ ] Update or add documentation (if features were changed or added) ๐
- [x] Make sure the status checks below are successful โ
A picture of a cute animal (not mandatory, but encouraged) ๐ฆ
๐ Benchmark results
Comparing with ec1a05eaa567db80ad84da9364b5be5ac7c082b0
Package size: 222 MB
(no change)
^ 228 MB
โ โโโโ 222 MB 222 MB 222 MB 222 MB 222 MB 222 MB 222 MB 222 MB 222 MB 222 MB 222 MB 222 MB
โ | | โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โ | | | | | | | | | | | | | | | | | | | | | | | | |โโ|
โโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโโโโดโโโดโโ>
T-12 T-11 T-10 T-9 T-8 T-7 T-6 T-5 T-4 T-3 T-2 T-1 T
Legend
- T-30 (4a6cb0e6f1aec54b74c1b70678ba0ceaf1b5c08a): 228 MB
- T-29 (f02d08e2f86064322547b416dec51ea1d16987fa): 228 MB
- T-28 (64e48dcd3440e137fb9d6d88f4bc1473878af304): 228 MB
- T-27 (7c209cbd0bb6480a0f09444ce49c64eb6711f5da): 228 MB
- T-26 (f362ec752e805323ae26c3c633d7f5920b88498b): 228 MB
- T-25 (585d91e597420bd40d6240f2f02c9623ba6bd99c): 228 MB
- T-24 (91f4ab26087319c1df411cabf108dcee712153d5): 228 MB
- T-23 (868ec26799bc1ae506c4421a579e30cab37266a8): 228 MB
- T-22 (df0c767dc9e97b765f21aa26836b028a784c0d46): 228 MB
- T-21 (0290c4590c1dfb8a7ac485137ab8dacfa0c62927): 228 MB
- T-20 (7337755f16fcd8b8cfa2eff362f2a81d21b484b7): 228 MB
- T-19 (fb72d92c9ba23a5f41ddf7cd9850efd94fecee9d): 228 MB
- T-18 (7317269130ac4017d7d4771ae955f6424ce59e40): 228 MB
- T-17 (3dfa6e522577a7404a7effe0f46ac950a149618a): 228 MB
- T-16 (11b9887e4ef52b9c8cd0097f457d4a7ed08e4f3b): 228 MB
- T-15 (399493929d24bd7d8c2d0ecff165ab7c08b0ceb7): 228 MB
- T-14 (53facba9d475a495e1685b8c30bfec6aa2248dca): 228 MB
- T-13 (d50692225d6364e6598be49d5adb8f76199d500e): 228 MB
- T-12 (dc0615e299afdd9333b892e449021a6be89f0f41): 228 MB
- T-11 (27b484309ee1338451c3b3c0a36e4c6feafed6fd): 222 MB
- T-10 (1e83238ec549c7eaa6eb79ae6a413f85e4b09d5d): 222 MB
- T-9 (ea87d4508e8fcd9e387f8f3d04256f4b64b3cffa): 222 MB
- T-8 (d00841dd913ed6765f1098820b1bd266541edbf1): 222 MB
- T-7 (060c2057723e056030f816ef93b3a8619f83d520): 222 MB
- T-6 (d2d7665979769b4dde34513d9c7df5b7c37d54cc): 222 MB
- T-5 (55df50052240910c4d065634380ba683f600b815): 222 MB
- T-4 (e1b911f9c78e7a49fff90f0d48142bda90469526): 222 MB
- T-3 (58732a298352d8ca5e3766f1076e03a94282a0d5): 222 MB
- T-2 (ddeec5ea06007d8f2ea201fa744b495be1e78216): 222 MB
- T-1 (ec1a05eaa567db80ad84da9364b5be5ac7c082b0): 222 MB
- T (current commit): 222 MB
Note: I confirmed w/ https://github.com/eric-silverman on Slack for approval before creating the PR for the attached issue.
Can we add an additional assertion that tests the
:splatbehavior with functions?
Yeah. I'll add a test-case.
Feel free to merge. You can also use kodiak for merging, by simply adding the automerge label.
@danez I don't have access to merge or add any labels yet.
Oh I see, I can merge if you want?
Oh I see, I can merge if you want?
Yeah. Please do.