Skip to content

Commit a10cc10

Browse files
committed
missing decode query parameter in Req.request
1 parent 51d83e1 commit a10cc10

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/common/req.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ let dummy = {
2828
req_id = Uuidm.nil
2929
}
3030

31-
let add_params req params =
31+
let add_params ?(decode=false) req params =
3232
let req_params =
3333
List.fold_left (fun map (arg, l1) ->
34+
let arg = if decode then Url.decode arg else arg in
35+
let l1 = if decode then List.map Url.decode l1 else l1 in
3436
match StringMap.find_opt arg map with
3537
| Some l0 -> StringMap.add arg (l0 @ l1) map
3638
| None -> StringMap.add arg l1 map
@@ -46,7 +48,7 @@ let request ?(version=`HTTP_1_1) ?(headers=StringMap.empty) ?(time=0.) uri =
4648
let content_type = match StringMap.find_opt "content-type" headers with
4749
| Some (c :: _) -> Some c
4850
| _ -> None in
49-
path_str, path, content_type, add_params req (Uri.query uri)
51+
path_str, path, content_type, add_params ~decode:true req (Uri.query uri)
5052

5153
let find_params p req = StringMap.find_opt p.Param.param_id req.req_params
5254

0 commit comments

Comments
 (0)