apisix
apisix copied to clipboard
fix: handle consul nil port cases by defaulting to port 80
Description
When using consul as a service registry, if a user registers a service without filling in the port number, the default value is not set in apisix, resulting in svc_port possibly being nil, which in turn results in local service_id = svc_address ... “:” ... svc_port cannot be spliced.
Which issue(s) this PR fixes:
Fixes https://github.com/apache/apisix/issues/11134
Checklist
- [x] I have explained the need for this PR and the problem it solves
- [x] I have explained the changes or the new features added to this PR
- [x] I have added tests corresponding to this change
- [ ] I have updated the documentation to reflect this change
- [ ] I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)