Rust library for talking to JSON HTTP servers
One method, request
, is exposed which makes HTTP requests and provides
automatic serialization/deserialization of Rust types to JSON.
```rust extern crate rustcserialize; extern crate jsonrequest;
use json_request::{request, Method};
struct RequestData { ping: bool }
struct ResponseData { pong: bool }
// data
is the object to be serialized and sent to the HTTP server
let data = RequestData { ping: true };
// Actually build the request let res = request(Method::Post, "http://example.com/", data);
// Request returns a Result
Add the following to your Cargo.toml
toml
[dependencies.json-request]
git = "https://github.com/jwilm/json-request"
data
parameter should be url encoded and appended to the URL for
GET requests.