Fixes apigw prefilter for string with hyphen

This commit is contained in:
Vivek Patel
2021-10-01 10:08:58 +02:00
committed by Denis Arh
parent 4092f1bfc7
commit 2d2e02b3a0
10 changed files with 89 additions and 9 deletions
@@ -17,4 +17,12 @@ func Test_prefilter_header_failing(t *testing.T) {
Expect(t).
Status(http.StatusBadRequest).
End()
h.apiInit().
Get("/test-hyphen").
Header("Accept-Language", "fr-CH, fr;q=0.9").
Header("Token", "brute-force-guess").
Expect(t).
Status(http.StatusBadRequest).
End()
}
@@ -17,4 +17,12 @@ func Test_prefilter_header_passing(t *testing.T) {
Expect(t).
Status(http.StatusOK).
End()
h.apiInit().
Get("/test-hyphen").
Header("Accept-Language", "fr-CH, fr;q=0.9").
Header("Token", "super-secret-token").
Expect(t).
Status(http.StatusOK).
End()
}
@@ -17,4 +17,12 @@ func Test_prefilter_query_failing(t *testing.T) {
Expect(t).
Status(http.StatusBadRequest).
End()
h.apiInit().
Get("/test-hyphen").
Query("foo-bar", "encrypted-string").
Header("Accept", "application/json").
Expect(t).
Status(http.StatusBadRequest).
End()
}
@@ -17,4 +17,12 @@ func Test_prefilter_query_passing(t *testing.T) {
Expect(t).
Status(http.StatusOK).
End()
h.apiInit().
Get("/test-hyphen").
Query("foo-bar", "encrypted-string").
Header("Accept", "application/json").
Expect(t).
Status(http.StatusOK).
End()
}
@@ -7,3 +7,12 @@ apigateway:
kind: "prefilter"
params:
expr: "Token == \"super-secret-token\""
- endpoint: /test-hyphen
method: GET
enabled: true
filters:
- ref: "header"
kind: "prefilter"
params:
expr: "Accept-Language == \"fr-CH, fr;q=0.9\""
@@ -7,3 +7,12 @@ apigateway:
kind: "prefilter"
params:
expr: "Token == \"super-secret-token\""
- endpoint: /test-hyphen
method: GET
enabled: true
filters:
- ref: "header"
kind: "prefilter"
params:
expr: "headers[\"Accept-Language\"] == \"fr-CH, fr;q=0.9\""
+10
View File
@@ -7,3 +7,13 @@ apigateway:
kind: "prefilter"
params:
expr: "token == \"super-secret-token\""
- endpoint: /test-hyphen
method: GET
enabled: true
filters:
- ref: "queryParam"
kind: "prefilter"
params:
expr: "foo-bar == \"encrypted-string\""
+9
View File
@@ -7,3 +7,12 @@ apigateway:
kind: "prefilter"
params:
expr: "token == \"super-secret-token\""
- endpoint: /test-hyphen
method: GET
enabled: true
filters:
- ref: "queryParam"
kind: "prefilter"
params:
expr: "params[\"foo-bar\"] == \"encrypted-string\""