X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Focaml-http%2Fhttp_request.ml;h=cd2dcd16563f8dfdd1139ba951e8720e54520dae;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=664256548f047aa692e408bf680768cd7c04f2e9;hpb=2026624f827b29c35d54aa67b301250123ea7311;p=helm.git diff --git a/helm/DEVEL/ocaml-http/http_request.ml b/helm/DEVEL/ocaml-http/http_request.ml index 664256548..cd2dcd165 100644 --- a/helm/DEVEL/ocaml-http/http_request.ml +++ b/helm/DEVEL/ocaml-http/http_request.ml @@ -103,14 +103,16 @@ class request ic = method meth = meth method uri = uri_str method path = path - method param ?meth name = - (match (meth: meth option) with - | None -> - (try - Hashtbl.find params_tbl name - with Not_found -> raise (Param_not_found name)) - | Some `GET -> List.assoc name query_get_params - | Some `POST -> List.assoc name query_post_params) + method param ?(meth: meth option) ?(default: string option) name = + try + (match meth with + | None -> Hashtbl.find params_tbl name + | Some `GET -> List.assoc name query_get_params + | Some `POST -> List.assoc name query_post_params) + with Not_found -> + (match default with + | None -> raise (Param_not_found name) + | Some value -> value) method paramAll ?meth name = (match (meth: meth option) with | None -> List.rev (Hashtbl.find_all params_tbl name)