zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.

Home Page:https://go-zero.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

httpx.Parse returns 500 error if all arguments have defaults and no value submitted

Cwt-ting opened this issue · comments

Describe the bug
提交参数只有2个可选时,2个参数都不传的情况下 会报 httpx.Parse 500 解析错误
ed0b8003850ea7ac1082aa417771a10

To Reproduce
Steps to reproduce the behavior, if applicable:

  1. The code is

    	var req types.ApplyFriendsListReq
     	if err := httpx.Parse(r, &req); err != nil {
     		httpx.Error(w, err)
     		return
     	}
  2. The error is

    
    

1635836540(1)


**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environments (please complete the following information):**
- OS: [e.g. Linux]
- go-zero version [e.g. 1.2.1]
- goctl version [e.g. 1.2.1, optional]

**More description**
Add any other context about the problem here.

I cannot reproduce this issue, check the code here: https://github.com/kevwan/zero-issues/tree/main/1197

The problem from the definition of error handling

1635986263(1)