actix / actix/actix-web

Default behavior for errors while deserializing body as json

オープン
#1,684 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
A-web C-improvement
主要言語
Rust
スター
24.8k
フォーク
1.9k
平均マージ
23時間 10分
マージ済み PR(30日)
26

説明

Currently there is only a 400 when a correct body is not provided.
`async fn index(query: web::Json) -> String {`

## Expected Behavior
An error should be provided as it is done for the query parameters:
**Body deserialize Json error: invalid type: string \"k\", expected f32, line: 4, column: 16))**
Query:
**Query deserialize error: missing field `first`**

## Current Behavior
Currently only a 400 is provided.

## Possible Solution

## Steps to Reproduce (for bugs)
implement a handler with `web::Json` and provide json with missing mandatory fields.

* Rust Version (I.e, output of `rustc -V`):
web::Json
* Actix Web Version: 3

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。