Commit graph

15 commits

Author SHA1 Message Date
Edwin Török
5ba64ee30a ezcurl: allow POST with non-form data
Currently ezcurl always sets CURLOPT_HTTPPOST, but that means it is not able
to send a custom body that is not a form (e.g. JSON is quite a common use-case
these days).

Add a special case: if the POST params is empty, *and* a 'content' is set, then
just set CURLOPT_POST, but not CURLOPT_HTTPPOST.

Example usage:
```
let contents = Ezjsonm.to_string json in
let config = EZ.Config.(verbose true default) in
match EZ.post ~config ~url ~params:[] ~content:(`String contents) () with
```

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
2023-02-02 12:05:46 -05:00
Simon Cruanes
cfcd23d16a fix: do not reset client if passed as argument
close #7
2023-01-25 13:43:35 -05:00
Simon Cruanes
c568f9e4e3
fix setting of headers
close #6
2021-10-07 13:09:23 -04:00
Simon Cruanes
3d12ab0c1d
fix warning 2021-09-29 09:05:28 -04:00
Simon Cruanes
fe35e81fe0 minor changes to improve compatibility 2021-09-29 09:05:05 -04:00
zapashcanon
7b0c8230ae add a default user-agent 2021-09-29 09:05:05 -04:00
Simon Cruanes
a1e2d7f600 enrich content type so it can be a stream.
- content is now either a string, or a callback function writing into
  a buffer
- also fix potential performance issue in body reading
- add `?content` to post
2021-07-30 12:43:36 -04:00
Simon Cruanes
6795c5b64a style 2021-07-22 11:04:34 -04:00
Simon Cruanes
fa37890804 feat: add a way to send content 2019-09-14 12:50:33 -05:00
Simon Cruanes
54e7d1740f feat: add more methods, add range parameter 2019-09-14 11:28:28 -05:00
Simon Cruanes
637674f6d0 feat: add some printers 2019-09-14 10:54:53 -05:00
Simon Cruanes
d6c687d16c doc: use mdx to update the readme (and test) 2019-09-14 10:27:06 -05:00
Simon Cruanes
bf31f32a5b feat: add lwt wrapper 2019-09-14 10:00:38 -05:00
Simon Cruanes
80fc740e39 add Config value 2019-09-13 21:42:33 -05:00
Simon Cruanes
84f3a147a7 initial commit 2019-09-13 18:22:56 -05:00