Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

health check has an error message #2368

Closed
840963657 opened this issue Mar 8, 2022 · 4 comments
Closed

health check has an error message #2368

840963657 opened this issue Mar 8, 2022 · 4 comments
Labels
bug Something isn't working frontend good first issue Good for newcomers

Comments

@840963657
Copy link

Issue description

1、add new route;
2、enable health check and add a header parameter;
3、modify route and remove the header parameter;
4、when i submit , there is an error message displayed in the browser

Expected behavior

add route success

How to Reproduce

1、add new route;
2、enable health check;
3、add a header parameter ;
4、submit;
5、modify this route;
6、remove the header parameter;
7、submit;

Screenshots

image
image
image

Environment

  • apisix version (cmd: apisix version):2.11.0
  • OS (cmd: uname -a):linux
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):openresty/1.19.9.1
  • etcd version, if have (cmd: run etcd --version):etcd Version: 3.4.13
  • apisix-dashboard version, if have:2.11.0
  • Browser version, if have: chrome(97.0.4692.71)

Additional context

I checked the apisix code. req_headers is an array, if req_headers not nil ,then there is at least one value in req_headers.
So I think apisix-dashboard pass apisix an empty array,like this: req_headers[]。
Then apisix validate failed,error message is: Array must have at least 1 items

@840963657 840963657 added the bug Something isn't working label Mar 8, 2022
@Baoyuantop
Copy link
Contributor

Hi @840963657, thanks for your report. After examination, there is indeed this problem. Would you like to help fix this problem?

The reason

The request headers in the health check are empty by default, and in this case, there is no req_headers field in the request data sent by the web to the API. However, when the user makes changes in this field, especially by removing all request headers, the data sent to the API contains the req_headers field and the value is an empty array, which causes an error.

Possible solutions

The UI form ensures that requests sent to the API always do not contain the req_headers field, regardless of whether the initial value of the request header is empty or the user removes all the request headers. And send the correct array of data to the API after the user has entered the request headers

@840963657
Copy link
Author

Hi @840963657, thanks for your report. After examination, there is indeed this problem. Would you like to help fix this problem?

The reason

The request headers in the health check are empty by default, and in this case, there is no req_headers field in the request data sent by the web to the API. However, when the user makes changes in this field, especially by removing all request headers, the data sent to the API contains the req_headers field and the value is an empty array, which causes an error.

Possible solutions

The UI form ensures that requests sent to the API always do not contain the req_headers field, regardless of whether the initial value of the request header is empty or the user removes all the request headers. And send the correct array of data to the API after the user has entered the request headers

I‘m sorry,I'm not familiar with JS...’

@guoqqqi
Copy link
Member

guoqqqi commented Mar 12, 2022

The UI form ensures that requests sent to the API always do not contain the req_headers field, regardless of whether the initial value of the request header is empty or the user removes all the request headers. And send the correct array of data to the API after the user has entered the request headers

@Si-ege Do you have time to help solve this problem?

@Si-ege
Copy link
Contributor

Si-ege commented Mar 12, 2022

I can try to complete the question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants