actix / actix/actix-web

Parsing optional field seems to not work for numbers when not filled

未关闭
#1,815 22 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
A-web C-improvement
主要语言
Rust
星标
24.8k
派生
1.9k
平均合并
23 小时 10 分钟
30 天内合并 PR
26

描述

Hello, I currently try to parse a form but I have a Parse error for a specific case:

```
struct TestForm {
text: Option,
number: Option
}
```

1. Whether I filled the text input field or not, it ends up being `Some("whatever") or 'None'.
2. When I fill the number input field (a html text input), It parses to `Some(123)`.
3. But when I don't fill the number field, it fails and return a `Parse error` (a `UrlencodedError::Parse` error apparently)

Same behaviour for f32 so far I've tested.

* Rust Version: 1.48.0
* Actix Web Version: 3.3.2

Thanks a lot for the help.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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