~repos /plum
git clone https://pyrossh.dev/repos/plum.git
A statically typed, imperative programming language inspired by rust, python
6fd1e28a
—
pyrossh 1 year ago
docs
- std/http.mi +10 -21
std/http.mi
CHANGED
|
@@ -7,30 +7,19 @@ fn file_response(file: str) =
|
|
|
7
7
|
content := content_type::from_ext(ext)
|
|
8
8
|
data := try os.read_file(file)
|
|
9
9
|
Response(
|
|
10
|
-
header("Content-Type", content)
|
|
11
|
-
header("Content-Length", "2")
|
|
12
|
-
body(data)
|
|
13
|
-
status(200)
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
Response(
|
|
17
|
-
status = 200
|
|
10
|
+
status = 200,
|
|
18
|
-
|
|
11
|
+
headers = [
|
|
19
|
-
Content-Type
|
|
12
|
+
:Content-Type => content,
|
|
20
|
-
Content-Length
|
|
13
|
+
:Content-Length => "2"
|
|
21
|
-
]
|
|
14
|
+
],
|
|
22
15
|
body = data
|
|
23
16
|
)
|
|
24
17
|
|
|
25
18
|
Response::build()
|
|
26
|
-
.
|
|
19
|
+
.set_header("Content-Type", content)
|
|
27
|
-
.
|
|
20
|
+
.set_header("Content-Length", "2")
|
|
28
|
-
.
|
|
21
|
+
.set_body(data)
|
|
29
|
-
.
|
|
22
|
+
.set_status(200)
|
|
30
|
-
|
|
31
|
-
response.new(200)
|
|
32
|
-
|> response.header("Content-Type", content)
|
|
33
|
-
|> response.body(data)
|
|
34
23
|
|
|
35
24
|
#[get("/")]
|
|
36
25
|
fn index(): Response! =
|
|
@@ -44,7 +33,7 @@ fn public(file: str): Response! =
|
|
|
44
33
|
Response(
|
|
45
34
|
status: 200,
|
|
46
35
|
headers: [
|
|
47
|
-
|
|
36
|
+
:ContentType => content,
|
|
48
37
|
],
|
|
49
38
|
body: data,
|
|
50
39
|
)
|