Permalink
Browse files

Map the `put` function to HTTP PUT instead of POST

Closes #6
  • Loading branch information...
avsm committed Sep 28, 2012
1 parent 7fd1e1a commit f363fe525e1ecb4a5b7a303b2c30637399e64a05
Showing with 5 additions and 3 deletions.
  1. +3 −1 lib/code.ml
  2. +1 −1 lib/code.mli
  3. +1 −1 lwt/cohttp_lwt.ml
View
@@ -22,7 +22,7 @@
(** Type definitions *)
type version = [ `HTTP_1_0 | `HTTP_1_1 ]
-type meth = [ `GET | `POST | `HEAD | `DELETE |`PATCH ]
+type meth = [ `GET | `POST | `HEAD | `DELETE |`PATCH |`PUT ]
type informational_status =
[ `Continue
@@ -105,13 +105,15 @@ let string_of_method = function
| `HEAD -> "HEAD"
| `DELETE -> "DELETE"
| `PATCH -> "PATCH"
+ | `PUT -> "PUT"
let method_of_string = function
| "GET" -> Some `GET
| "POST" -> Some `POST
| "HEAD" -> Some `HEAD
| "DELETE" -> Some `DELETE
| "PATCH" -> Some `PATCH
+ | "PUT" -> Some `PUT
| _ -> None
let status_of_code (x:int) : status_code = match x with
View
@@ -19,7 +19,7 @@
*)
type version = [ `HTTP_1_0 | `HTTP_1_1 ]
-type meth = [ `GET | `POST | `HEAD | `DELETE | `PATCH ]
+type meth = [ `GET | `POST | `HEAD | `DELETE | `PATCH | `PUT ]
type informational_status =
[ `Continue
View
@@ -62,7 +62,7 @@ module Client(Request:REQUEST)
let get ?headers uri = call ?headers `GET uri
let delete ?headers uri = call ?headers `DELETE uri
let post ?body ?chunked ?headers uri = call ?headers ?body ?chunked `POST uri
- let put ?body ?chunked ?headers uri = call ?headers ?body ?chunked `POST uri
+ let put ?body ?chunked ?headers uri = call ?headers ?body ?chunked `PUT uri
let patch ?body ?chunked ?headers uri = call ?headers ?body ?chunked `PATCH uri
let post_form ?headers ~params uri =

0 comments on commit f363fe5

Please sign in to comment.