@@ -58,9 +58,9 @@ var _ = Describe("RequestAccessor tests", func() {
5858 })
5959
6060 qsRequest := getProxyRequest ("/hello" , "GET" )
61- qsRequest .QueryStringParameters = map [string ]string {
62- "hello" : "1" ,
63- "world" : "2" ,
61+ qsRequest .MultiValueQueryStringParameters = map [string ][ ]string {
62+ "hello" : { "1" } ,
63+ "world" : { "2" , "3" } ,
6464 }
6565 It ("Populates query string correctly" , func () {
6666 httpReq , err := accessor .ProxyEventToHTTPRequest (qsRequest )
@@ -73,65 +73,10 @@ var _ = Describe("RequestAccessor tests", func() {
7373 Expect (query ["hello" ]).ToNot (BeNil ())
7474 Expect (query ["world" ]).ToNot (BeNil ())
7575 Expect (1 ).To (Equal (len (query ["hello" ])))
76- Expect (1 ).To (Equal (len (query ["world" ])))
77- Expect ("1" ).To (Equal (query ["hello" ][0 ]))
78- Expect ("2" ).To (Equal (query ["world" ][0 ]))
79- })
80-
81- mvqsRequest := getProxyRequest ("/hello" , "GET" )
82- mvqsRequest .MultiValueQueryStringParameters = map [string ][]string {
83- "hello" : {"1" , "2" },
84- "world" : {"3" , "4" },
85- }
86- It ("Populates multi value query string correctly" , func () {
87- httpReq , err := accessor .ProxyEventToHTTPRequest (mvqsRequest )
88- Expect (err ).To (BeNil ())
89- Expect ("/hello" ).To (Equal (httpReq .URL .Path ))
90- Expect ("GET" ).To (Equal (httpReq .Method ))
91-
92- query := httpReq .URL .Query ()
93- Expect (2 ).To (Equal (len (query )))
94- Expect (query ["hello" ]).ToNot (BeNil ())
95- Expect (query ["world" ]).ToNot (BeNil ())
96- Expect (2 ).To (Equal (len (query ["hello" ])))
9776 Expect (2 ).To (Equal (len (query ["world" ])))
9877 Expect ("1" ).To (Equal (query ["hello" ][0 ]))
99- Expect ("2" ).To (Equal (query ["hello" ][1 ]))
100- Expect ("3" ).To (Equal (query ["world" ][0 ]))
101- Expect ("4" ).To (Equal (query ["world" ][1 ]))
102- })
103-
104- qsAndMVQSRequest := getProxyRequest ("/hello" , "GET" )
105- qsAndMVQSRequest .QueryStringParameters = map [string ]string {
106- "hello1" : "1" ,
107- "world1" : "2" ,
108- }
109- qsAndMVQSRequest .MultiValueQueryStringParameters = map [string ][]string {
110- "hello2" : {"3" , "4" },
111- "world2" : {"5" , "6" },
112- }
113- It ("Populates query string and multi value query string correctly" , func () {
114- httpReq , err := accessor .ProxyEventToHTTPRequest (qsAndMVQSRequest )
115- Expect (err ).To (BeNil ())
116- Expect ("/hello" ).To (Equal (httpReq .URL .Path ))
117- Expect ("GET" ).To (Equal (httpReq .Method ))
118-
119- query := httpReq .URL .Query ()
120- Expect (4 ).To (Equal (len (query )))
121- Expect (query ["hello1" ]).ToNot (BeNil ())
122- Expect (query ["world1" ]).ToNot (BeNil ())
123- Expect (query ["hello2" ]).ToNot (BeNil ())
124- Expect (query ["world2" ]).ToNot (BeNil ())
125- Expect (1 ).To (Equal (len (query ["hello1" ])))
126- Expect (1 ).To (Equal (len (query ["world1" ])))
127- Expect (2 ).To (Equal (len (query ["hello2" ])))
128- Expect (2 ).To (Equal (len (query ["world2" ])))
129- Expect ("1" ).To (Equal (query ["hello1" ][0 ]))
130- Expect ("2" ).To (Equal (query ["world1" ][0 ]))
131- Expect ("3" ).To (Equal (query ["hello2" ][0 ]))
132- Expect ("4" ).To (Equal (query ["hello2" ][1 ]))
133- Expect ("5" ).To (Equal (query ["world2" ][0 ]))
134- Expect ("6" ).To (Equal (query ["world2" ][1 ]))
78+ Expect ("2" ).To (Equal (query ["world" ][0 ]))
79+ Expect ("3" ).To (Equal (query ["world" ][1 ]))
13580 })
13681
13782 basePathRequest := getProxyRequest ("/app1/orders" , "GET" )
0 commit comments