Skip to content

Commit

Permalink
chagne type to typedef.headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mayocream committed Jan 19, 2022
1 parent b132829 commit 2bdcc6b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion autodoc/admin-api/data/admin-api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ return {
["healthchecks.active.http_path"] = { description = [[Path to use in GET HTTP request to run as a probe on active health checks.]] },
["healthchecks.active.https_verify_certificate"] = { description = [[Whether to check the validity of the SSL certificate of the remote host when performing active health checks using HTTPS.]] },
["healthchecks.active.https_sni"] = { description = [[The hostname to use as an SNI (Server Name Identification) when performing active health checks using HTTPS. This is particularly useful when Targets are configured using IPs, so that the target host's certificate can be verified with the proper SNI.]], example = "example.com", },
["healthchecks.active.headers"] = { description = [[An array of HTTP Headers to use in GET HTTP request to run as a probe on active health checks. Values must be pre-formatted.]], example = { "User-Agent: curl/7.64.0" }, },
["healthchecks.active.headers"] = { description = [[One or more lists of values indexed by header name to use in GET HTTP request to run as a probe on active health checks. Values must be pre-formatted.]], example = { { ["x-my-header"] = {"foo", "bar"}, ["x-another-header"] = {"bla"} }, nil }, },
["healthchecks.active.healthy.interval"] = { description = [[Interval between active health checks for healthy targets (in seconds). A value of zero indicates that active probes for healthy targets should not be performed.]] },
["healthchecks.active.healthy.http_statuses"] = { description = [[An array of HTTP statuses to consider a success, indicating healthiness, when returned by a probe in active health checks.]] },
["healthchecks.active.healthy.successes"] = { description = [[Number of successes in active probes (as defined by `healthchecks.active.healthy.http_statuses`) to consider a target healthy.]] },
Expand Down
11 changes: 1 addition & 10 deletions kong/db/schema/entities/upstreams.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,6 @@ local check_verify_certificate = Schema.define {
required = true,
}

local check_headers = Schema.define {
type = "array",
len_min = 1,
elements = {
type = "string",
unique = true,
},
}

local health_threshold = Schema.define {
type = "number",
default = 0,
Expand Down Expand Up @@ -145,7 +136,7 @@ local types = {
http_statuses = http_statuses,
https_sni = typedefs.sni,
https_verify_certificate = check_verify_certificate,
headers = check_headers,
headers = typedefs.headers,
}


Expand Down
8 changes: 4 additions & 4 deletions spec/01-unit/01-db/01-schema/09-upstreams_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ describe("load upstreams", function()
local number = "expected a number"
local array = "expected an array"
local string = "expected a string"
local map = "expected a map"
local len_min_default = "length must be at least 1"
local invalid_host = "invalid value: "
local invalid_host_port = "must not have a port"
Expand All @@ -307,11 +308,10 @@ describe("load upstreams", function()
{{ active = { https_sni = "hello-.example.com", }}, invalid_host },
{{ active = { https_sni = "example.com:1234", }}, invalid_host_port },
{{ active = { https_verify_certificate = "ovo", }}, boolean },
{{ active = { headers = 0, }}, array },
{{ active = { headers = {}, }}, len_min_default },
{{ active = { headers = 0, }}, map },
{{ active = { headers = { 0 }, }}, string },
{{ active = { headers = { "" }, }}, len_min_default },
{{ active = { headers = { 123, "example" }, }}, string },
{{ active = { headers = { "" }, }}, string },
{{ active = { headers = { ["x-header"] = 123 }, }}, array },
{{ active = { healthy = { interval = -1 }}}, seconds },
{{ active = { healthy = { interval = 1e+42 }}}, seconds },
{{ active = { healthy = { http_statuses = 404 }}}, array },
Expand Down

0 comments on commit 2bdcc6b

Please sign in to comment.