Changes after merging

This commit is contained in:
Paramtamtam 2022-01-31 10:46:51 +05:00
parent 42523ae9d9
commit f72c2b85fd
No known key found for this signature in database
GPG Key ID: 366371698FAD0A2B
6 changed files with 28 additions and 15 deletions

View File

@ -6,8 +6,15 @@ The format is based on [Keep a Changelog][keepachangelog] and this project adher
### UNRELEASED
### Changed
- Go updated from `1.17.5` up to `1.17.6`
- Add "Host" and "X-Forwarded-For" Header to error pages
### Added
- `Host` and `X-Forwarded-For` Header to error pages [#61]
[#61]:https://github.com/tarampampam/error-pages/pull/61
## v2.4.0

View File

@ -25,7 +25,7 @@ const (
// RequestID is a unique ID that identifies the request - same as for backend service
RequestID = "X-Request-ID"
// Forward-For identifies the user of this session
// ForwardedFor identifies the user of this session
ForwardedFor = "X-Forwarded-For"
// Host identifies the hosts origin

View File

@ -13,7 +13,7 @@ type Properties struct { // only string properties with a "token" tag, please
ServicePort string `token:"service_port"`
RequestID string `token:"request_id"`
ForwardedFor string `token:"forwarded_for"`
Host string `token:"host"`
Host string `token:"host"`
ShowRequestDetails bool
}

View File

@ -9,17 +9,17 @@ import (
func TestProperties_Replaces(t *testing.T) {
props := tpl.Properties{
Code: "foo",
Message: "bar",
Description: "baz",
OriginalURI: "aaa",
Namespace: "bbb",
IngressName: "ccc",
ServiceName: "ddd",
ServicePort: "eee",
RequestID: "fff",
ForwardedFor:"ggg",
Host: "hhh",
Code: "foo",
Message: "bar",
Description: "baz",
OriginalURI: "aaa",
Namespace: "bbb",
IngressName: "ccc",
ServiceName: "ddd",
ServicePort: "eee",
RequestID: "fff",
ForwardedFor: "ggg",
Host: "hhh",
}
r := props.Replaces()

View File

@ -7,6 +7,8 @@ X-Ingress-Name: baz
X-Service-Name: aaa
X-Service-Port: bbb
X-Request-ID: ccc
X-Forwarded-For: ddd
Host: eee
HTTP/* 200
@ -23,6 +25,8 @@ jsonpath "$.details.ingress_name" == "baz"
jsonpath "$.details.service_name" == "aaa"
jsonpath "$.details.service_port" == "bbb"
jsonpath "$.details.request_id" == "ccc"
jsonpath "$.details.forwarded_for" == "ddd"
jsonpath "$.details.host" == "eee"
jsonpath "$.details.timestamp" isInteger
# X-Format in the action

View File

@ -7,6 +7,8 @@ X-Ingress-Name: baz
X-Service-Name: aaa
X-Service-Port: bbb
X-Request-ID: ccc
X-Forwarded-For: ddd
Host: eee
HTTP/* 200
@ -23,7 +25,7 @@ xpath "string(//error/details/serviceName)" == "aaa"
xpath "string(//error/details/servicePort)" == "bbb"
xpath "string(//error/details/requestID)" == "ccc"
xpath "string(//error/details/forwardedFor)" == "ddd"
xpath "string(//error/details/host)" == "fff"
xpath "string(//error/details/host)" == "eee"
xpath "string(//error/details/timestamp)" exists
# X-Format in the action