File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class RequestData {
2727
2828 factory RequestData .fromHttpRequest (Request request) {
2929 var params = Map <String , dynamic >();
30- request.url.queryParameters .forEach ((key, value) {
30+ request.url.queryParametersAll .forEach ((key, value) {
3131 params[key] = value;
3232 });
3333 String baseUrl = request.url.origin + request.url.path;
Original file line number Diff line number Diff line change @@ -67,6 +67,23 @@ main() {
6767 equals (
6868 "https://www.google.com/helloworld?key=123ABC&name=Hugo&type=3" ));
6969 });
70+ test ("can be instantiated from HTTP GET Request with multiple parameters with same key" , () {
71+ // Arrange
72+ Uri url = Uri .parse (
73+ "https://www.google.com/helloworld?name=Hugo&type=2&type=3&type=4" );
74+
75+ Request request = Request ("GET" , url);
76+ RequestData requestData;
77+
78+ // Act
79+ requestData = RequestData .fromHttpRequest (request);
80+
81+ // Assert
82+ expect (
83+ requestData.url,
84+ equals (
85+ "https://www.google.com/helloworld?name=Hugo&type=2&type=3&type=4" ));
86+ });
7087 test ("correctly creates the request URL string" , () {
7188 // Arrange
7289 Uri url = Uri .parse (
You can’t perform that action at this time.
0 commit comments