2
2
package "moonbitlang/async/http"
3
3
4
4
import(
5
+ "moonbitlang/async/io"
5
6
"moonbitlang/async/socket"
6
7
)
7
8
8
9
// Values
9
- async fn get(String, headers? : Map[String, String], port? : Int, body? : &Body ) -> (Response, &Body )
10
+ async fn get(String, headers? : Map[String, String], port? : Int, body? : &@io.Data ) -> (Response, &@io.Data )
10
11
11
- async fn post(String, &Body , headers? : Map[String, String], port? : Int) -> (Response, &Body )
12
+ async fn post(String, &@io.Data , headers? : Map[String, String], port? : Int) -> (Response, &@io.Data )
12
13
13
- async fn put(String, &Body , headers? : Map[String, String], port? : Int) -> (Response, &Body )
14
+ async fn put(String, &@io.Data , headers? : Map[String, String], port? : Int) -> (Response, &@io.Data )
14
15
15
16
// Errors
16
17
pub suberror HttpProtocolError {
@@ -32,14 +33,13 @@ fn Client::close(Self) -> Unit
32
33
async fn Client::connect(String, headers? : Map[String, String], protocol? : Protocol, port? : Int) -> Self
33
34
async fn Client::end_request(Self) -> Response
34
35
async fn Client::flush(Self) -> Unit
35
- async fn Client::get(Self, String, extra_headers? : Map[String, String], body? : &Body) -> Response
36
- async fn Client::post(Self, String, &Body, extra_headers? : Map[String, String]) -> Response
37
- async fn Client::put(Self, String, &Body, extra_headers? : Map[String, String]) -> Response
38
- async fn Client::read_all(Self) -> &Body
36
+ async fn Client::get(Self, String, extra_headers? : Map[String, String], body? : &@io.Data) -> Response
37
+ async fn Client::post(Self, String, &@io.Data, extra_headers? : Map[String, String]) -> Response
38
+ async fn Client::put(Self, String, &@io.Data, extra_headers? : Map[String, String]) -> Response
39
39
async fn Client::request(Self, RequestMethod, String, extra_headers? : Map[String, String]) -> Unit
40
40
async fn Client::skip_response_body(Self) -> Unit
41
- impl @moonbitlang/async/ io.Reader for Client
42
- impl @moonbitlang/async/ io.Writer for Client
41
+ impl @io.Reader for Client
42
+ impl @io.Writer for Client
43
43
44
44
pub(all) enum Protocol {
45
45
Http
@@ -77,22 +77,13 @@ fn ServerConnection::close(Self) -> Unit
77
77
async fn ServerConnection::end_response(Self) -> Unit
78
78
async fn ServerConnection::flush(Self) -> Unit
79
79
fn ServerConnection::new(@socket.TCP, headers? : Map[String, String]) -> Self
80
- async fn ServerConnection::read_all(Self) -> &Body
81
80
async fn ServerConnection::read_request(Self) -> Request
82
81
async fn ServerConnection::send_response(Self, Int, String, extra_headers? : Map[String, String]) -> Unit
83
82
async fn ServerConnection::skip_request_body(Self) -> Unit
84
- impl @moonbitlang/async/io.Reader for ServerConnection
85
- impl @moonbitlang/async/io.Writer for ServerConnection
86
-
87
- async fn Body::binary(&Self) -> Bytes
88
- async fn Body::json(&Self) -> Json
89
- async fn Body::text(&Self) -> String
83
+ impl @io.Reader for ServerConnection
84
+ impl @io.Writer for ServerConnection
90
85
91
86
// Type aliases
92
87
93
88
// Traits
94
- trait Body
95
- impl Body for String
96
- impl Body for Bytes
97
- impl Body for Json
98
89
0 commit comments