fix: change default headers to empty table instead of an array to remove deprecation notice#174
Conversation
|
|
Signed-off-by: Jay Chen <1180092+jijiechen@users.noreply.github.com>
13a81b1
| https_sni = NO_DEFAULT, | ||
| https_verify_certificate = true, | ||
| headers = {""}, | ||
| headers = NO_DEFAULT_NON_NESTED, |
There was a problem hiding this comment.
This is the actual modification that fixes the issue, it is still to change the default value of the headers from an array to a table.
However, the test failed by the first commit because the original code at function fill_in_settings treated arrays and non-array tables differently. This caused the table I modified yesterday to be treated as a "multi-level nested object", hence tables passed from external also process incorrectly, this ultimately causing all headers to be wiped.
lua-resty-healthcheck/lib/resty/healthcheck.lua
Lines 1450 to 1453 in 6e5b09b
|
The fix is as follows:
|
The library deprecated usage of array headers on health check settings long ago in commit fae6e84 and it added a deprecation notice.
However, the headers field in default settings was left as an array
{ "" }, which causes all checks without explicit headers are triggering this deprecation notice.lua-resty-healthcheck/lib/resty/healthcheck.lua
Lines 1042 to 1046 in 6e5b09b
This PR changes the default value to be an empty table instead of the default array. The new default value is well covered by existing test cases, so no need to add new ones.