Vincent Ambo
448cc5e1d4
chore(cargo): Bump version to v0.2.2
2019-02-27 14:41:30 +01:00
Vincent Ambo
951bc7ae85
refactor(tests): Use local httpbin instance in tests
...
Instead of relying on the external httpbin instance which is
occasionally wonky, use Docker to spin up a local instance in Travis
CI when testing.
This fixes #1 .
2019-02-27 14:39:16 +01:00
Vincent Ambo
67bfba446d
fix(lib): Support large body uploads with repeated read callbacks
...
When uploading larger amounts of data, cURL will call the read
callback incrementally multiple times to receive all the expected
data.
Previously if the size of the data to upload exceeded the size of the
initial buffer provided by cURL, the write (and thus the request)
would fail.
This changes the logic to write the data in chunks of a size that are
acceptable to cURL.
2019-02-27 14:39:16 +01:00
Vincent Ambo
a18dfc5a5e
docs(README): Fix crates.io badge URL
2019-02-26 23:11:29 +01:00
Vincent Ambo
9a23a55165
chore(cargo): Bump version to v0.2.0
2019-02-26 23:10:24 +01:00
Vincent Ambo
3530baa4d0
refactor: Add a method per HTTP verb on Request
...
Instead of the `Request::new` "constructor" for requests, add a method
per HTTP verb which makes the initialisation slightly more concise.
2019-02-26 23:10:24 +01:00
Vincent Ambo
e4e931661b
feat: Introduce Response::error_for_status
method
...
This method makes it possible to let users map responses with
unexpected HTTP statuses to custom errors while staying inside a chain
of results.
2019-02-26 22:21:43 +01:00
Vincent Ambo
481825672e
feat: Re-export the curl::init
method
2019-02-26 18:00:30 +01:00
Vincent Ambo
a039908fc4
test: Add timeouts to HTTP POST tests
...
Occasionally (and seemingly most commonly in travis-ci), httpbin does
not respond to POST requests.
2019-02-26 17:58:20 +01:00
Vincent Ambo
cf58060fcc
feat: Add Request::with_handle
method
...
This method acts as an "escape-hatch" which lets the user configure
whatever they want on the cURL easy handle. No warranty!
2019-02-26 17:55:00 +01:00
Vincent Ambo
df117f855b
feat: Add Request::timeout
method
2019-02-26 17:54:47 +01:00
Vincent Ambo
acc7e64a0d
refactor: Use cURL's own basic auth implementation
...
Drops the dependency on the base64-crate, which it turns out isn't
necessary as cURL has this built-in.
2019-02-26 17:54:11 +01:00
Vincent Ambo
de86cc551a
docs(README): Add badges for travis, docs.rs and crates.io
2019-02-26 17:33:59 +01:00
Vincent Ambo
53489a7bab
chore(build): Configure Travis CI builds
2019-02-26 17:30:56 +01:00
Vincent Ambo
2233d15c94
chore(cargo): Prepare Cargo manifest for crate release
2019-02-26 17:30:56 +01:00
Vincent Ambo
f5ab42c147
chore: License under GPL-3.0-or-later
2019-02-26 17:30:56 +01:00
Vincent Ambo
198fe2bffa
docs: Update README, add contribution guidelines & CoC
...
... getting all the docs in order for publication ...
2019-02-26 17:30:53 +01:00
Vincent Ambo
2349dd22c3
feat: Split tls_key_password
into a separate function
...
WHen configuring a PKCS12 certificate it is more useful to be able to
set this separately, as the `tls_client_key` function is never called.
2019-02-26 17:30:53 +01:00
Vincent Ambo
37dc54f2bf
feat: Add utility functions for TLS client certificate usage
2019-02-26 17:30:53 +01:00
Vincent Ambo
791e2958fc
test: Add test for token-based authentication (bearer_auth)
2019-02-26 17:30:53 +01:00
Vincent Ambo
b493bc3c84
docs(lib): Document available features and update example
2019-02-26 17:30:49 +01:00
Vincent Ambo
de16d9698d
feat: Add optional Request::basic_auth
utility function
...
This function adds a dependency on `base64` and is thus gated behind
the (enabled by default) `basic_auth` feature.
2019-02-26 17:30:49 +01:00
Vincent Ambo
bd726c7d4c
feat: Add Response::is_success utility method
2019-02-26 17:30:49 +01:00
Vincent Ambo
415e930a07
feat: Add bearer_auth
helper function
...
Adds a helper function for setting `Bearer`-tokens in `Authorization`
headers.
2019-02-26 17:30:49 +01:00
Vincent Ambo
aedfd7c7ac
feat: Add support for form-encoded POST bodies
2019-02-26 17:30:49 +01:00
Vincent Ambo
d3a47d3b1c
refactor: Move URL & method configuration to send()
...
This lets the builder proceed without returning a `Result` from the
initial call, which makes for a slightly nicer API.
2019-02-26 17:30:49 +01:00
Vincent Ambo
9ce0098bc0
docs(lib): Update docstrings for rustdoc output
2019-02-26 17:30:45 +01:00
Vincent Ambo
569e10e509
test: Add tests for HTTP verbs & POSTing data
2019-02-26 14:45:06 +01:00
Vincent Ambo
b71b44a672
fix: Correctly configure body sizes before setting read_function
2019-02-26 14:33:42 +01:00
Vincent Ambo
718d945753
refactor: Use mut self
-consuming builder functions
...
Writing the functions this way makes it slightly nicer to chain them
without having to assign the request to an intermediate variable.
2019-02-26 14:33:02 +01:00
Vincent Ambo
c6c1746428
refactor: Introduce json
feature and make it optional
...
Gates support for `serde_json` behind a Cargo feature called `json`
that is enabled by default.
2019-02-26 13:49:43 +01:00
Vincent Ambo
479a6b3442
feat: Support JSON body serialization in requests & responses
...
Uses `serde_json` to provide serialisation and deserialisation of
request/response bodies.
2019-02-26 13:46:02 +01:00
Vincent Ambo
b28f6e748d
feat: Initial check-in of working client layer
2019-02-26 11:20:38 +01:00
Vincent Ambo
e95a82ca4c
chore: Initial commit
2019-02-25 18:03:21 +01:00