Azure / Azure/static-web-apps-cli

Route rewrite removes Query Parameters

未关闭
#930 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
668
派生
155
PR 合并指标
30 天内没有已合并 PR

描述

Before filing this issue, please ensure you're using the latest CLI by running `swa --version` and comparing to the latest version on [npm](https://www.npmjs.com/package/@azure/static-web-apps-cli).

**Are you accessing the CLI from the default port `:4280` ?**

- [ ] No, I am using a different port number (`--port`) and accessing the CLI from that port
- [x] Yes, I am accessing the CLI from port `:4280`

> Make sure you are accessing the URL printed in the console when running `swa start`!

**ℹ️ NOTE: Make sure to enable debug logs when running any `swa` commands using `--verbose=silly`**

**Describe the bug**
When defining a route rewrite in the `staticwebapp.config.json` like this:
```
{
"routes": [
{
"route": "/something",
"rewrite": "/api/something"
}
}
```
The query parameters are not passed to the rewritten route.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a route as described above
2. In the API endpoint `something` log the query parameters from the request
3. Run `npx swa start public --api-location http://localhost:7071`
4. Request `http://localhost:4280/something?key=value`
5. Notice in API logs that no query parameters arrive

**Expected behavior**
The query parameters from the initial request are available in the API.

**Desktop (please complete the following information):**

- OS: Windows
- Version 11

贡献指南

打开贡献指南

调研方向

使用 staticwebapp.config.json、`npx swa start public --api-location http://localhost:7071` 以及对 `/something?key=value` 的请求重现该问题;启用 `--verbose=silly` 日志。先从 CLI 的路由重写和 API 转发入口开始,然后验证 API 是否收到原始查询参数,并为此行为添加覆盖测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
azure, typescript
领域
api, cli
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。