Skip to content

Commit

Permalink
Force hosts to have at least one character
Browse files Browse the repository at this point in the history
  • Loading branch information
alombarte committed Oct 8, 2024
1 parent c6b5603 commit 584cbbd
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 2 deletions.
87 changes: 87 additions & 0 deletions test/v2.7/backend.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"description": "Backend object test",
"target": "https://www.krakend.io/schema/v2.7/backend.json",
"tests": [
{
"description": "Simple backend declaration with no host",
"data": {
"url_pattern": "/__debug/root"
},
"valid": true
},
{
"description": "Simple backend declaration with host",
"data": {
"url_pattern": "/__debug/root",
"host": [
"amqp://blah"
]
},
"valid": true
},
{
"description": "Simple backend declaration with empty string host",
"data": {
"url_pattern": "/__debug/root",
"host": [
""
]
},
"valid": false
},
{
"description": "Simple backend declaration with no pattern",
"data": {
"host": [
"http://foo"
]
},
"valid": false
},
{
"description": "Backend declaration with a few components",
"data": {
"host": [
"http://127.0.0.1:8080"
],
"input_headers": [
"Accept"
],
"url_pattern": "/__debug/",
"extra_config": {
"auth/ntlm": {
"user": "user",
"password": "pass"
},
"auth/gcp": {
"audience": "https://gcptest-76fewi6rca-uc.a.run.app",
"credentials_file": "/etc/krakend/gcp.json",
"custom_claims": {
"a": 1
}
},
"backend/http": {
"return_error_code": true,
"@extra_comment": "here"
},
"backend/soap": {
"path": "./path/to.xml",
"content_type": "application/xml",
"debug": false
},
"modifier/body-generator": {
"content_type": "application/json",
"debug": false,
"template": "abcdef"
},
"modifier/response-body-generator": {
"content_type": "application/json",
"debug": false,
"template": "abcdef"
}
}
},
"valid": true
}
]
}
6 changes: 5 additions & 1 deletion v2.7/backend.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@
"$id": "#backend/host",
"title": "Host array",
"description": "An array with all the available hosts to [load balance](https://www.krakend.io/docs/throttling/load-balancing/#balancing-egress-traffic-to-upstream) requests, including the schema (when possible) `schema://host:port`. E.g.: ` https://my.users-ms.com`. If you are in a platform where hosts or services are balanced (e.g., a K8S service), write a single entry in the array with the service name/balancer address. Defaults to the `host` declaration at the configuration's root level, and the service fails starting when there is none.",
"type": "array"
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
},
"input_headers": {
"$id": "#backend/input_headers",
Expand Down
6 changes: 5 additions & 1 deletion v2.7/krakend.json
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,11 @@
"host": {
"title": "Host array",
"description": "An array with all the available hosts to [load balance](https://www.krakend.io/docs/throttling/load-balancing/#balancing-egress-traffic-to-upstream) requests, including the schema (when possible) `schema://host:port`. E.g.: ` https://my.users-ms.com`. If you are in a platform where hosts or services are balanced (e.g., a K8S service), write a single entry in the array with the service name/balancer address. Defaults to the `host` declaration at the configuration's root level, and the service fails starting when there is none.",
"type": "array"
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
},
"input_headers": {
"title": "Allowed Headers In",
Expand Down

0 comments on commit 584cbbd

Please sign in to comment.