1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
extern crate actix_web;

mod assert;
mod expect;
pub mod expect_builder;
pub mod request_builder;

pub use self::expect::Expect;
use actix_web::client::ClientRequest;
use actix_web::http;
use request_builder::GabiraRequestBuilder;

fn req(path: &str, method: http::Method) -> GabiraRequestBuilder {
  GabiraRequestBuilder {
    req_builder: {
      let mut builder = ClientRequest::build();
      builder.uri(path).method(method);
      builder
    },
  }
}

#[must_use]
pub fn get(path: &str) -> GabiraRequestBuilder {
  req(path, http::Method::GET)
}

#[must_use]
pub fn head(path: &str) -> GabiraRequestBuilder {
  req(path, http::Method::HEAD)
}

#[must_use]
pub fn post(path: &str) -> GabiraRequestBuilder {
  req(path, http::Method::POST)
}

#[must_use]
pub fn put(path: &str) -> GabiraRequestBuilder {
  req(path, http::Method::PUT)
}

#[must_use]
pub fn delete(path: &str) -> GabiraRequestBuilder {
  req(path, http::Method::DELETE)
}

#[must_use]
pub fn trace(path: &str) -> GabiraRequestBuilder {
  req(path, http::Method::TRACE)
}

#[must_use]
pub fn options(path: &str) -> GabiraRequestBuilder {
  req(path, http::Method::OPTIONS)
}

#[must_use]
pub fn connect(path: &str) -> GabiraRequestBuilder {
  req(path, http::Method::CONNECT)
}

#[must_use]
pub fn patch(path: &str) -> GabiraRequestBuilder {
  req(path, http::Method::PATCH)
}