mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-10 23:57:34 +02:00
ppl: add support for http_path and http_method (#2813)
* ppl: add support for http_path and http_method * fix import ordering
This commit is contained in:
parent
54ec88fb93
commit
2d04106e6d
13 changed files with 257 additions and 18 deletions
|
@ -90,15 +90,15 @@ func Test_getEvaluatorRequest(t *testing.T) {
|
|||
Session: evaluator.RequestSession{
|
||||
ID: "SESSION_ID",
|
||||
},
|
||||
HTTP: evaluator.RequestHTTP{
|
||||
Method: "GET",
|
||||
URL: "http://example.com/some/path?qs=1",
|
||||
Headers: map[string]string{
|
||||
HTTP: evaluator.NewRequestHTTP(
|
||||
"GET",
|
||||
mustParseURL("http://example.com/some/path?qs=1"),
|
||||
map[string]string{
|
||||
"Accept": "text/html",
|
||||
"X-Forwarded-Proto": "https",
|
||||
},
|
||||
ClientCertificate: certPEM,
|
||||
},
|
||||
certPEM,
|
||||
),
|
||||
}
|
||||
assert.Equal(t, expect, actual)
|
||||
}
|
||||
|
@ -296,15 +296,15 @@ func Test_getEvaluatorRequestWithPortInHostHeader(t *testing.T) {
|
|||
expect := &evaluator.Request{
|
||||
Policy: &a.currentOptions.Load().Policies[0],
|
||||
Session: evaluator.RequestSession{},
|
||||
HTTP: evaluator.RequestHTTP{
|
||||
Method: "GET",
|
||||
URL: "http://example.com/some/path?qs=1",
|
||||
Headers: map[string]string{
|
||||
HTTP: evaluator.NewRequestHTTP(
|
||||
"GET",
|
||||
mustParseURL("http://example.com/some/path?qs=1"),
|
||||
map[string]string{
|
||||
"Accept": "text/html",
|
||||
"X-Forwarded-Proto": "https",
|
||||
},
|
||||
ClientCertificate: certPEM,
|
||||
},
|
||||
certPEM,
|
||||
),
|
||||
}
|
||||
assert.Equal(t, expect, actual)
|
||||
}
|
||||
|
@ -414,3 +414,11 @@ func TestAuthorize_Check(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func mustParseURL(rawURL string) url.URL {
|
||||
u, err := url.Parse(rawURL)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return *u
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue