mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-12 08:37:38 +02:00
integration: add test for query string params (#3302)
This commit is contained in:
parent
2e1366c417
commit
820be99a2f
1 changed files with 37 additions and 0 deletions
|
@ -6,6 +6,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -15,6 +16,42 @@ import (
|
||||||
"github.com/pomerium/pomerium/integration/flows"
|
"github.com/pomerium/pomerium/integration/flows"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestQueryStringParams(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
ctx, clearTimeout := context.WithTimeout(ctx, time.Second*30)
|
||||||
|
defer clearTimeout()
|
||||||
|
|
||||||
|
qs := url.Values{
|
||||||
|
"q1": {"a&b&c"},
|
||||||
|
"q2": {"x?y?z"},
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := http.NewRequestWithContext(ctx, "GET", "https://httpdetails.localhost.pomerium.io/?"+qs.Encode(), nil)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := getClient().Do(req)
|
||||||
|
if !assert.NoError(t, err, "unexpected http error") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
|
var result struct {
|
||||||
|
Query map[string]string
|
||||||
|
}
|
||||||
|
err = json.NewDecoder(res.Body).Decode(&result)
|
||||||
|
if !assert.NoError(t, err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Equal(t, map[string]string{
|
||||||
|
"q1": "a&b&c",
|
||||||
|
"q2": "x?y?z",
|
||||||
|
}, result.Query,
|
||||||
|
"expected custom request header to be sent upstream")
|
||||||
|
}
|
||||||
|
|
||||||
func TestCORS(t *testing.T) {
|
func TestCORS(t *testing.T) {
|
||||||
if ClusterType == "traefik" || ClusterType == "nginx" {
|
if ClusterType == "traefik" || ClusterType == "nginx" {
|
||||||
t.Skip()
|
t.Skip()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue