dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Postman is not working when parameter is empty and [input type = Json]

Open victor138128 opened this issue 1 year ago • 1 comments

Problem

When implementing the Post method, if the input type is Json and no parameters are entered, the error Args|EOF while parsing a value at line 1 column 0 is displayed.

Steps To Reproduce

  • Write a Post function with input and output type as Json
  • Run after build
  • Check post API operation with postman

Expected behavior

API normal call

Screenshots 스크린샷 2024-10-28 13-37-28

Environment:

  • Dioxus version: 0.6.0-alpha.3
  • Rust version: 1.81.0
  • OS info: Ubuntu 22.04
  • App platform: web, fullstack

Questionnaire

#[server(endpoint = "/m1/logs", input=Json, output=Json)]
pub async fn store_data() -> Result<(), ServerFnError> {
    Ok(())
}

When you specify the input and output type as Json and call the api, an error saying Args|EOF while parsing a value at line 1 column 0 is displayed. However, if the input type is set to PostUrl, it appears to be called normally even if it is an empty parameter. Wouldn't it be correct to make a normal call even if the input type is Json?

victor138128 avatar Oct 28 '24 04:10 victor138128

An empty string is an invalid JSON, so you should pass {} as a request body.

ryo33 avatar Oct 28 '24 05:10 ryo33