@@ -29,13 +29,13 @@ where
29
29
addr
30
30
}
31
31
32
- pub ( crate ) struct TestClient {
32
+ pub struct TestClient {
33
33
client : reqwest:: Client ,
34
34
addr : SocketAddr ,
35
35
}
36
36
37
37
impl TestClient {
38
- pub ( crate ) fn new < S > ( svc : S ) -> Self
38
+ pub fn new < S > ( svc : S ) -> Self
39
39
where
40
40
S : Service < Request , Response = Response , Error = Infallible > + Clone + Send + ' static ,
41
41
S :: Future : Send ,
@@ -50,63 +50,63 @@ impl TestClient {
50
50
TestClient { client, addr }
51
51
}
52
52
53
- pub ( crate ) fn get ( & self , url : & str ) -> RequestBuilder {
53
+ pub fn get ( & self , url : & str ) -> RequestBuilder {
54
54
RequestBuilder {
55
55
builder : self . client . get ( format ! ( "http://{}{url}" , self . addr) ) ,
56
56
}
57
57
}
58
58
59
- pub ( crate ) fn head ( & self , url : & str ) -> RequestBuilder {
59
+ pub fn head ( & self , url : & str ) -> RequestBuilder {
60
60
RequestBuilder {
61
61
builder : self . client . head ( format ! ( "http://{}{url}" , self . addr) ) ,
62
62
}
63
63
}
64
64
65
- pub ( crate ) fn post ( & self , url : & str ) -> RequestBuilder {
65
+ pub fn post ( & self , url : & str ) -> RequestBuilder {
66
66
RequestBuilder {
67
67
builder : self . client . post ( format ! ( "http://{}{url}" , self . addr) ) ,
68
68
}
69
69
}
70
70
71
71
#[ allow( dead_code) ]
72
- pub ( crate ) fn put ( & self , url : & str ) -> RequestBuilder {
72
+ pub fn put ( & self , url : & str ) -> RequestBuilder {
73
73
RequestBuilder {
74
74
builder : self . client . put ( format ! ( "http://{}{url}" , self . addr) ) ,
75
75
}
76
76
}
77
77
78
78
#[ allow( dead_code) ]
79
- pub ( crate ) fn patch ( & self , url : & str ) -> RequestBuilder {
79
+ pub fn patch ( & self , url : & str ) -> RequestBuilder {
80
80
RequestBuilder {
81
81
builder : self . client . patch ( format ! ( "http://{}{url}" , self . addr) ) ,
82
82
}
83
83
}
84
84
85
85
#[ allow( dead_code) ]
86
- pub ( crate ) fn server_port ( & self ) -> u16 {
86
+ pub fn server_port ( & self ) -> u16 {
87
87
self . addr . port ( )
88
88
}
89
89
}
90
90
91
- pub ( crate ) struct RequestBuilder {
91
+ pub struct RequestBuilder {
92
92
builder : reqwest:: RequestBuilder ,
93
93
}
94
94
95
95
impl RequestBuilder {
96
- pub ( crate ) fn body ( mut self , body : impl Into < reqwest:: Body > ) -> Self {
96
+ pub fn body ( mut self , body : impl Into < reqwest:: Body > ) -> Self {
97
97
self . builder = self . builder . body ( body) ;
98
98
self
99
99
}
100
100
101
- pub ( crate ) fn json < T > ( mut self , json : & T ) -> Self
101
+ pub fn json < T > ( mut self , json : & T ) -> Self
102
102
where
103
103
T : serde:: Serialize ,
104
104
{
105
105
self . builder = self . builder . json ( json) ;
106
106
self
107
107
}
108
108
109
- pub ( crate ) fn header < K , V > ( mut self , key : K , value : V ) -> Self
109
+ pub fn header < K , V > ( mut self , key : K , value : V ) -> Self
110
110
where
111
111
HeaderName : TryFrom < K > ,
112
112
<HeaderName as TryFrom < K > >:: Error : Into < http:: Error > ,
@@ -118,7 +118,7 @@ impl RequestBuilder {
118
118
}
119
119
120
120
#[ allow( dead_code) ]
121
- pub ( crate ) fn multipart ( mut self , form : reqwest:: multipart:: Form ) -> Self {
121
+ pub fn multipart ( mut self , form : reqwest:: multipart:: Form ) -> Self {
122
122
self . builder = self . builder . multipart ( form) ;
123
123
self
124
124
}
@@ -138,7 +138,7 @@ impl IntoFuture for RequestBuilder {
138
138
}
139
139
140
140
#[ derive( Debug ) ]
141
- pub ( crate ) struct TestResponse {
141
+ pub struct TestResponse {
142
142
response : reqwest:: Response ,
143
143
}
144
144
@@ -152,27 +152,27 @@ impl Deref for TestResponse {
152
152
153
153
impl TestResponse {
154
154
#[ allow( dead_code) ]
155
- pub ( crate ) async fn bytes ( self ) -> Bytes {
155
+ pub async fn bytes ( self ) -> Bytes {
156
156
self . response . bytes ( ) . await . unwrap ( )
157
157
}
158
158
159
- pub ( crate ) async fn text ( self ) -> String {
159
+ pub async fn text ( self ) -> String {
160
160
self . response . text ( ) . await . unwrap ( )
161
161
}
162
162
163
163
#[ allow( dead_code) ]
164
- pub ( crate ) async fn json < T > ( self ) -> T
164
+ pub async fn json < T > ( self ) -> T
165
165
where
166
166
T : serde:: de:: DeserializeOwned ,
167
167
{
168
168
self . response . json ( ) . await . unwrap ( )
169
169
}
170
170
171
- pub ( crate ) async fn chunk ( & mut self ) -> Option < Bytes > {
171
+ pub async fn chunk ( & mut self ) -> Option < Bytes > {
172
172
self . response . chunk ( ) . await . unwrap ( )
173
173
}
174
174
175
- pub ( crate ) async fn chunk_text ( & mut self ) -> Option < String > {
175
+ pub async fn chunk_text ( & mut self ) -> Option < String > {
176
176
let chunk = self . chunk ( ) . await ?;
177
177
Some ( String :: from_utf8 ( chunk. to_vec ( ) ) . unwrap ( ) )
178
178
}
0 commit comments