actix / actix/actix-web

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

Đang mở
#1,815 22 bình luận 0 reaction 0 người được giao Xem trên GitHub
A-web C-improvement
Ngôn ngữ chính
Rust
Star
24.8k
Fork
1.9k
Merge trung bình
23 giờ 10 phút
Pull request đã merge (30 ngày)
26

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.