Skip to content

Commit df3d415

Browse files
committed
build: update mocket version to 0.6.1
1 parent f56e873 commit df3d415

File tree

5 files changed

+13
-219
lines changed

5 files changed

+13
-219
lines changed

moon.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oboard/mocket",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"deps": {
55
"illusory0x0/native": "0.2.1",
66
"moonbitlang/x": "0.4.34",

src/cookie.mbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ pub fn parse_cookie(cookie : StringView) -> Map[String, CookieItem] {
110110

111111
for curr = cookie {
112112
// TODO: more spec compliance
113+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
113114
lexmatch curr with longest {
114115
("[ \t]+", rest) => continue rest
115116
(

src/cookie_test.mbt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ test "parse_cookie_multiple_with_attributes" {
6464
}
6565
None => fail("Expected c2")
6666
}
67+
match cookies.get("SameSite") {
68+
Some(item) => assert_eq(item.value, "Strict")
69+
None => fail("Expected SameSite cookie")
70+
}
6771
}
6872

6973
///|

src/js/pkg.generated.mbti

Lines changed: 0 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -1,207 +1,13 @@
11
// Generated using `moon info`, DON'T EDIT IT
22
package "oboard/mocket/js"
33

4-
import(
5-
"moonbitlang/core/json"
6-
)
7-
84
// Values
9-
async fn[T] async_all(Array[async () -> T]) -> Array[T]
10-
11-
let async_iterator : Symbol
12-
13-
fn async_run(async () -> Unit noraise) -> Unit
14-
15-
fn async_test(async () -> Unit) -> Unit
16-
17-
let globalThis : Value
18-
19-
let iterator : Symbol
20-
21-
fn require(String, keys? : Array[String]) -> Value
22-
23-
fn[T, E : Error] spawn_detach(async () -> T raise E) -> Unit
24-
25-
async fn[T, E : Error] suspend(((T) -> Unit, (E) -> Unit) -> Unit) -> T raise E
265

276
// Errors
28-
pub suberror Error_ Value
29-
fn Error_::cause(Self) -> Value?
30-
fn[T] Error_::wrap(() -> Value, map_ok? : (Value) -> T) -> T raise Self
31-
impl Show for Error_
327

338
// Types and methods
34-
type Nullable[_]
35-
fn[T] Nullable::from_option(T?) -> Self[T]
36-
fn[T] Nullable::get_exn(Self[T]) -> T
37-
fn[T] Nullable::is_null(Self[T]) -> Bool
38-
fn[T] Nullable::null() -> Self[T]
39-
fn[T] Nullable::to_option(Self[T]) -> T?
40-
fn[T] Nullable::unwrap(Self[T]) -> T
41-
42-
pub struct Object(Value)
43-
fn[K, V] Object::extend_iter(Self, Iter[(K, V)]) -> Unit
44-
fn[K, V] Object::extend_iter2(Self, Iter2[K, V]) -> Unit
45-
fn Object::extend_object(Self, Self) -> Self
46-
fn[K, V] Object::from_iter(Iter[(K, V)]) -> Self
47-
fn[K, V] Object::from_iter2(Iter2[K, V]) -> Self
48-
fn Object::from_value(Value) -> Optional[Self]
49-
fn Object::from_value_unchecked(Value) -> Self
50-
#deprecated
51-
fn Object::inner(Self) -> Value
52-
fn Object::new() -> Self
53-
fn[K, V] Object::op_get(Self, K) -> V
54-
fn[K, V] Object::op_set(Self, K, V) -> Unit
55-
fn Object::to_value(Self) -> Value
56-
57-
type Optional[_]
58-
fn[T] Optional::from_option(T?) -> Self[T]
59-
fn[T] Optional::get_exn(Self[T]) -> T
60-
fn[T] Optional::is_undefined(Self[T]) -> Bool
61-
fn[T] Optional::to_option(Self[T]) -> T?
62-
fn[T] Optional::undefined() -> Self[T]
63-
fn[T] Optional::unwrap(Self[T]) -> T
64-
65-
#external
66-
pub type Promise
67-
fn Promise::all(Array[Self]) -> Self
68-
fn[T] Promise::unsafe_new(async () -> T) -> Self
69-
async fn Promise::wait(Self) -> Value
70-
71-
type Symbol
72-
fn Symbol::make() -> Self
73-
fn Symbol::make_with_number(Double) -> Self
74-
fn Symbol::make_with_string(String) -> Self
75-
fn Symbol::make_with_string_js(String) -> Self
76-
77-
type Union2[_, _]
78-
fn[A : Cast, B] Union2::from0(A) -> Self[A, B]
79-
fn[A, B : Cast] Union2::from1(B) -> Self[A, B]
80-
fn[A : Cast, B] Union2::to0(Self[A, B]) -> A?
81-
fn[A, B : Cast] Union2::to1(Self[A, B]) -> B?
82-
83-
type Union3[_, _, _]
84-
fn[A : Cast, B, C] Union3::from0(A) -> Self[A, B, C]
85-
fn[A, B : Cast, C] Union3::from1(B) -> Self[A, B, C]
86-
fn[A, B, C : Cast] Union3::from2(C) -> Self[A, B, C]
87-
fn[A : Cast, B, C] Union3::to0(Self[A, B, C]) -> A?
88-
fn[A, B : Cast, C] Union3::to1(Self[A, B, C]) -> B?
89-
fn[A, B, C : Cast] Union3::to2(Self[A, B, C]) -> C?
90-
91-
type Union4[_, _, _, _]
92-
fn[A : Cast, B, C, D] Union4::from0(A) -> Self[A, B, C, D]
93-
fn[A, B : Cast, C, D] Union4::from1(B) -> Self[A, B, C, D]
94-
fn[A, B, C : Cast, D] Union4::from2(C) -> Self[A, B, C, D]
95-
fn[A, B, C, D : Cast] Union4::from3(D) -> Self[A, B, C, D]
96-
fn[A : Cast, B, C, D] Union4::to0(Self[A, B, C, D]) -> A?
97-
fn[A, B : Cast, C, D] Union4::to1(Self[A, B, C, D]) -> B?
98-
fn[A, B, C : Cast, D] Union4::to2(Self[A, B, C, D]) -> C?
99-
fn[A, B, C, D : Cast] Union4::to3(Self[A, B, C, D]) -> D?
100-
101-
type Union5[_, _, _, _, _]
102-
fn[A : Cast, B, C, D, E] Union5::from0(A) -> Self[A, B, C, D, E]
103-
fn[A, B : Cast, C, D, E] Union5::from1(B) -> Self[A, B, C, D, E]
104-
fn[A, B, C : Cast, D, E] Union5::from2(C) -> Self[A, B, C, D, E]
105-
fn[A, B, C, D : Cast, E] Union5::from3(D) -> Self[A, B, C, D, E]
106-
fn[A, B, C, D, E : Cast] Union5::from4(E) -> Self[A, B, C, D, E]
107-
fn[A : Cast, B, C, D, E] Union5::to0(Self[A, B, C, D, E]) -> A?
108-
fn[A, B : Cast, C, D, E] Union5::to1(Self[A, B, C, D, E]) -> B?
109-
fn[A, B, C : Cast, D, E] Union5::to2(Self[A, B, C, D, E]) -> C?
110-
fn[A, B, C, D : Cast, E] Union5::to3(Self[A, B, C, D, E]) -> D?
111-
fn[A, B, C, D, E : Cast] Union5::to4(Self[A, B, C, D, E]) -> E?
112-
113-
type Union6[_, _, _, _, _, _]
114-
fn[A : Cast, B, C, D, E, F] Union6::from0(A) -> Self[A, B, C, D, E, F]
115-
fn[A, B : Cast, C, D, E, F] Union6::from1(B) -> Self[A, B, C, D, E, F]
116-
fn[A, B, C : Cast, D, E, F] Union6::from2(C) -> Self[A, B, C, D, E, F]
117-
fn[A, B, C, D : Cast, E, F] Union6::from3(D) -> Self[A, B, C, D, E, F]
118-
fn[A, B, C, D, E : Cast, F] Union6::from4(E) -> Self[A, B, C, D, E, F]
119-
fn[A, B, C, D, E, F : Cast] Union6::from5(F) -> Self[A, B, C, D, E, F]
120-
fn[A : Cast, B, C, D, E, F] Union6::to0(Self[A, B, C, D, E, F]) -> A?
121-
fn[A, B : Cast, C, D, E, F] Union6::to1(Self[A, B, C, D, E, F]) -> B?
122-
fn[A, B, C : Cast, D, E, F] Union6::to2(Self[A, B, C, D, E, F]) -> C?
123-
fn[A, B, C, D : Cast, E, F] Union6::to3(Self[A, B, C, D, E, F]) -> D?
124-
fn[A, B, C, D, E : Cast, F] Union6::to4(Self[A, B, C, D, E, F]) -> E?
125-
fn[A, B, C, D, E, F : Cast] Union6::to5(Self[A, B, C, D, E, F]) -> F?
126-
127-
type Union7[_, _, _, _, _, _, _]
128-
fn[A : Cast, B, C, D, E, F, G] Union7::from0(A) -> Self[A, B, C, D, E, F, G]
129-
fn[A, B : Cast, C, D, E, F, G] Union7::from1(B) -> Self[A, B, C, D, E, F, G]
130-
fn[A, B, C : Cast, D, E, F, G] Union7::from2(C) -> Self[A, B, C, D, E, F, G]
131-
fn[A, B, C, D : Cast, E, F, G] Union7::from3(D) -> Self[A, B, C, D, E, F, G]
132-
fn[A, B, C, D, E : Cast, F, G] Union7::from4(E) -> Self[A, B, C, D, E, F, G]
133-
fn[A, B, C, D, E, F : Cast, G] Union7::from5(F) -> Self[A, B, C, D, E, F, G]
134-
fn[A, B, C, D, E, F, G : Cast] Union7::from6(G) -> Self[A, B, C, D, E, F, G]
135-
fn[A : Cast, B, C, D, E, F, G] Union7::to0(Self[A, B, C, D, E, F, G]) -> A?
136-
fn[A, B : Cast, C, D, E, F, G] Union7::to1(Self[A, B, C, D, E, F, G]) -> B?
137-
fn[A, B, C : Cast, D, E, F, G] Union7::to2(Self[A, B, C, D, E, F, G]) -> C?
138-
fn[A, B, C, D : Cast, E, F, G] Union7::to3(Self[A, B, C, D, E, F, G]) -> D?
139-
fn[A, B, C, D, E : Cast, F, G] Union7::to4(Self[A, B, C, D, E, F, G]) -> E?
140-
fn[A, B, C, D, E, F : Cast, G] Union7::to5(Self[A, B, C, D, E, F, G]) -> F?
141-
fn[A, B, C, D, E, F, G : Cast] Union7::to6(Self[A, B, C, D, E, F, G]) -> G?
142-
143-
type Union8[_, _, _, _, _, _, _, _]
144-
fn[A : Cast, B, C, D, E, F, G, H] Union8::from0(A) -> Self[A, B, C, D, E, F, G, H]
145-
fn[A, B : Cast, C, D, E, F, G, H] Union8::from1(B) -> Self[A, B, C, D, E, F, G, H]
146-
fn[A, B, C : Cast, D, E, F, G, H] Union8::from2(C) -> Self[A, B, C, D, E, F, G, H]
147-
fn[A, B, C, D : Cast, E, F, G, H] Union8::from3(D) -> Self[A, B, C, D, E, F, G, H]
148-
fn[A, B, C, D, E : Cast, F, G, H] Union8::from4(E) -> Self[A, B, C, D, E, F, G, H]
149-
fn[A, B, C, D, E, F : Cast, G, H] Union8::from5(F) -> Self[A, B, C, D, E, F, G, H]
150-
fn[A, B, C, D, E, F, G : Cast, H] Union8::from6(G) -> Self[A, B, C, D, E, F, G, H]
151-
fn[A, B, C, D, E, F, G, H : Cast] Union8::from7(H) -> Self[A, B, C, D, E, F, G, H]
152-
fn[A : Cast, B, C, D, E, F, G, H] Union8::to0(Self[A, B, C, D, E, F, G, H]) -> A?
153-
fn[A, B : Cast, C, D, E, F, G, H] Union8::to1(Self[A, B, C, D, E, F, G, H]) -> B?
154-
fn[A, B, C : Cast, D, E, F, G, H] Union8::to2(Self[A, B, C, D, E, F, G, H]) -> C?
155-
fn[A, B, C, D : Cast, E, F, G, H] Union8::to3(Self[A, B, C, D, E, F, G, H]) -> D?
156-
fn[A, B, C, D, E : Cast, F, G, H] Union8::to4(Self[A, B, C, D, E, F, G, H]) -> E?
157-
fn[A, B, C, D, E, F : Cast, G, H] Union8::to5(Self[A, B, C, D, E, F, G, H]) -> F?
158-
fn[A, B, C, D, E, F, G : Cast, H] Union8::to6(Self[A, B, C, D, E, F, G, H]) -> G?
159-
fn[A, B, C, D, E, F, G, H : Cast] Union8::to7(Self[A, B, C, D, E, F, G, H]) -> H?
160-
161-
#external
162-
pub type Value
163-
fn[Arg, Result] Value::apply(Self, Array[Arg]) -> Result
164-
fn[Arg, Result] Value::apply_with_index(Self, Int, Array[Arg]) -> Result
165-
fn[Arg, Result] Value::apply_with_string(Self, String, Array[Arg]) -> Result
166-
fn[Arg, Result] Value::apply_with_symbol(Self, Symbol, Array[Arg]) -> Result
167-
fn[T] Value::cast(Self) -> T
168-
fn[T] Value::cast_from(T) -> Self
169-
fn Value::extends(Self, Self) -> Self
170-
fn Value::from_json(Json) -> Self raise
171-
fn Value::from_json_string(String) -> Self raise
172-
fn[T] Value::get_with_index(Self, Int) -> T
173-
fn[T] Value::get_with_string(Self, String) -> T
174-
fn[T] Value::get_with_symbol(Self, Symbol) -> T
175-
fn Value::is_bool(Self) -> Bool
176-
fn Value::is_null(Self) -> Bool
177-
fn Value::is_number(Self) -> Bool
178-
fn Value::is_object(Self) -> Bool
179-
fn Value::is_string(Self) -> Bool
180-
fn Value::is_symbol(Self) -> Bool
181-
fn Value::is_undefined(Self) -> Bool
182-
fn[Arg, Result] Value::new(Self, Array[Arg]) -> Result
183-
fn[Arg, Result] Value::new_with_index(Self, Int, Array[Arg]) -> Result
184-
fn[Arg, Result] Value::new_with_string(Self, String, Array[Arg]) -> Result
185-
fn[Arg, Result] Value::new_with_symbol(Self, Symbol, Array[Arg]) -> Result
186-
fn[T] Value::set_with_index(Self, Int, T) -> Unit
187-
fn[T] Value::set_with_string(Self, String, T) -> Unit
188-
fn[T] Value::set_with_symbol(Self, Symbol, T) -> Unit
189-
fn Value::to_json(Self) -> Json raise
190-
fn Value::to_json_string(Self) -> String raise
191-
fn Value::to_string(Self) -> String
192-
impl Show for Value
193-
impl @json.FromJson for Value
1949

19510
// Type aliases
19611

19712
// Traits
198-
pub(open) trait Cast {
199-
into(Value) -> Self?
200-
from(Self) -> Value
201-
}
202-
impl Cast for Bool
203-
impl Cast for Int
204-
impl Cast for Double
205-
impl Cast for String
206-
impl[A : Cast] Cast for Array[A]
20713

src/pkg.generated.mbti

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,17 @@
22
package "oboard/mocket"
33

44
import(
5+
"illusory0x0/native"
56
"moonbitlang/core/buffer"
6-
"oboard/mocket/js"
77
)
88

99
// Values
10-
fn __get_port_by_connection_js(String) -> Int
11-
12-
fn __get_port_by_connection_js_export((String) -> Int) -> Unit
13-
14-
fn __ws_emit_js_export((String, Int, String, Bytes) -> Unit) -> Unit
15-
16-
fn __ws_emit_js_port(String, Int, String, Bytes) -> Unit
17-
18-
fn __ws_get_members_js(String) -> Array[String]
19-
20-
fn __ws_state_js_export((String, String) -> Unit, (String, String) -> Unit, (String) -> Array[String]) -> Unit
21-
22-
fn __ws_subscribe_js(String, String) -> Unit
23-
24-
fn __ws_unsubscribe_js(String, String) -> Unit
10+
fn __ws_emit(@native.CStr, @native.CStr, @native.CStr) -> Unit
2511

2612
fn async_run(async () -> Unit noraise) -> Unit
2713

2814
fn cookie_to_string(Array[CookieItem]) -> String
2915

30-
fn create_server((HttpRequestInternal, HttpResponseInternal, () -> Unit) -> Unit, Int) -> Unit
31-
32-
fn encode_multipart(Map[String, MultipartFormValue], String) -> String
33-
3416
async fn execute_middlewares(Array[(String, async (MocketEvent, async () -> &Responder noraise) -> &Responder noraise)], MocketEvent, async (MocketEvent) -> &Responder noraise) -> &Responder noraise
3517

3618
fn form_encode(Map[String, String]) -> String
@@ -110,8 +92,8 @@ impl Responder for HttpRequest
11092

11193
#external
11294
pub type HttpRequestInternal
113-
fn HttpRequestInternal::req_method(Self) -> String
114-
fn HttpRequestInternal::url(Self) -> String
95+
fn HttpRequestInternal::on_complete(Self, FuncRef[() -> Unit]) -> Unit
96+
fn HttpRequestInternal::on_headers(Self, FuncRef[(@native.CStr) -> Unit]) -> Unit
11597

11698
pub(all) struct HttpResponse {
11799
mut status_code : StatusCode
@@ -129,8 +111,9 @@ impl Responder for HttpResponse
129111

130112
#external
131113
pub type HttpResponseInternal
132-
fn HttpResponseInternal::end(Self, @js.Value) -> Unit
133-
fn HttpResponseInternal::url(Self) -> String
114+
115+
#external
116+
pub type HttpServerInternal
134117

135118
#alias(T)
136119
pub(all) struct Mocket {

0 commit comments

Comments
 (0)