map can have function members by placing function declaration between the curly braces

This commit is contained in:
Francesco Cozzuto
2023-01-13 03:02:28 +01:00
parent 189bfa030b
commit 920b88c006
8 changed files with 208 additions and 131 deletions
+13 -9
View File
@@ -352,13 +352,17 @@ fun parse(src: String) {
return newRequest(method, url, version, headers);
}
sample = cat(
"GET /search?client=firefox-b-d&q=http+request+dataset HTTP/2\r\n",
"Host: www.google.com\r\n",
"user-agent: curl/7.84.0\r\n",
"accept: */*\r\n",
"\r\n");
fun test() {
sample = cat(
"GET /search?client=firefox-b-d&q=http+request+dataset HTTP/2\r\n",
"Host: www.google.com\r\n",
"user-agent: curl/7.84.0\r\n",
"accept: */*\r\n",
"\r\n");
request, error = parse(sample);
print("request=", request, "\n");
print("error=", error, "\n");
request, error = parse(sample);
print("request=", request, "\n");
print("error=", error, "\n");
}
return {parse: parse, test: test};