@@ -195,11 +195,11 @@ spec:
195195
196196 BeforeEach (beforeEachHTTP )
197197
198- It ("Create/Updtea /Delete HTTPRoute" , func () {
198+ It ("Create/Update /Delete HTTPRoute" , func () {
199199 By ("create HTTPRoute" )
200200 ResourceApplied ("HTTPRoute" , "httpbin" , exactRouteByGet , 1 )
201201
202- By ("access daataplane to check the HTTPRoute" )
202+ By ("access dataplane to check the HTTPRoute" )
203203 s .NewAPISIXClient ().
204204 GET ("/get" ).
205205 Expect ().
@@ -266,6 +266,29 @@ spec:
266266 - name: httpbin-service-e2e-test
267267 port: 80
268268`
269+ var varsRoute = `
270+ apiVersion: gateway.networking.k8s.io/v1
271+ kind: HTTPRoute
272+ metadata:
273+ name: httpbin
274+ spec:
275+ parentRefs:
276+ - name: api7ee
277+ hostnames:
278+ - httpbin.example
279+ rules:
280+ - matches:
281+ - path:
282+ type: Exact
283+ value: /get
284+ headers:
285+ - type: Exact
286+ name: X-Route-Name
287+ value: httpbin
288+ backendRefs:
289+ - name: httpbin-service-e2e-test
290+ port: 80
291+ `
269292
270293 var prefixRouteByStatus = `
271294apiVersion: gateway.networking.k8s.io/v1
@@ -372,6 +395,25 @@ spec:
372395 Expect ().
373396 Status (404 )
374397 })
398+
399+ It ("HTTPRoute Vars Match" , func () {
400+ By ("create HTTPRoute" )
401+ ResourceApplied ("HTTPRoute" , "httpbin" , varsRoute , 1 )
402+
403+ By ("access dataplane to check the HTTPRoute" )
404+ s .NewAPISIXClient ().
405+ GET ("/get" ).
406+ WithHost ("httpbin.example" ).
407+ Expect ().
408+ Status (http .StatusNotFound )
409+
410+ s .NewAPISIXClient ().
411+ GET ("/get" ).
412+ WithHost ("httpbin.example" ).
413+ WithHeader ("X-Route-Name" , "httpbin" ).
414+ Expect ().
415+ Status (http .StatusOK )
416+ })
375417 })
376418
377419 Context ("HTTPRoute Filters" , func () {
0 commit comments