mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib: remove deprecated map{} usages as well as deprecated functions (#11035)
This commit is contained in:
@@ -71,27 +71,27 @@ fn test_parse_request_line() {
|
||||
}
|
||||
|
||||
fn test_parse_form() {
|
||||
assert parse_form('foo=bar&bar=baz') == map{
|
||||
assert parse_form('foo=bar&bar=baz') == {
|
||||
'foo': 'bar'
|
||||
'bar': 'baz'
|
||||
}
|
||||
assert parse_form('foo=bar=&bar=baz') == map{
|
||||
assert parse_form('foo=bar=&bar=baz') == {
|
||||
'foo': 'bar='
|
||||
'bar': 'baz'
|
||||
}
|
||||
assert parse_form('foo=bar%3D&bar=baz') == map{
|
||||
assert parse_form('foo=bar%3D&bar=baz') == {
|
||||
'foo': 'bar='
|
||||
'bar': 'baz'
|
||||
}
|
||||
assert parse_form('foo=b%26ar&bar=baz') == map{
|
||||
assert parse_form('foo=b%26ar&bar=baz') == {
|
||||
'foo': 'b&ar'
|
||||
'bar': 'baz'
|
||||
}
|
||||
assert parse_form('a=b& c=d') == map{
|
||||
assert parse_form('a=b& c=d') == {
|
||||
'a': 'b'
|
||||
' c': 'd'
|
||||
}
|
||||
assert parse_form('a=b&c= d ') == map{
|
||||
assert parse_form('a=b&c= d ') == {
|
||||
'a': 'b'
|
||||
'c': ' d '
|
||||
}
|
||||
@@ -115,7 +115,7 @@ ${contents[1]}
|
||||
--------------------------$boundary--
|
||||
"
|
||||
form, files := parse_multipart_form(data, boundary)
|
||||
assert files == map{
|
||||
assert files == {
|
||||
names[0]: [FileData{
|
||||
filename: file
|
||||
content_type: ct
|
||||
@@ -123,7 +123,7 @@ ${contents[1]}
|
||||
}]
|
||||
}
|
||||
|
||||
assert form == map{
|
||||
assert form == {
|
||||
names[1]: contents[1]
|
||||
}
|
||||
}
|
||||
|
@@ -240,7 +240,7 @@ fn testsuite_end() {
|
||||
// It sends a request to the server to shutdown.
|
||||
x := http.fetch('http://127.0.0.1:$sport/shutdown',
|
||||
method: .get
|
||||
cookies: map{
|
||||
cookies: {
|
||||
'skey': 'superman'
|
||||
}
|
||||
) or {
|
||||
|
@@ -12,7 +12,7 @@ import time
|
||||
|
||||
pub const (
|
||||
methods_with_form = [http.Method.post, .put, .patch]
|
||||
headers_close = http.new_custom_header_from_map(map{
|
||||
headers_close = http.new_custom_header_from_map({
|
||||
'Server': 'VWeb'
|
||||
http.CommonHeader.connection.str(): 'close'
|
||||
}) or { panic('should never fail') }
|
||||
@@ -41,7 +41,7 @@ pub const (
|
||||
value: 'text/plain'
|
||||
).join(headers_close)
|
||||
)
|
||||
mime_types = map{
|
||||
mime_types = {
|
||||
'.css': 'text/css; charset=utf-8'
|
||||
'.gif': 'image/gif'
|
||||
'.htm': 'text/html; charset=utf-8'
|
||||
@@ -128,7 +128,7 @@ pub fn (mut ctx Context) send_response_to_client(mimetype string, res string) bo
|
||||
ctx.done = true
|
||||
|
||||
// build header
|
||||
header := http.new_header_from_map(map{
|
||||
header := http.new_header_from_map({
|
||||
http.CommonHeader.content_type: mimetype
|
||||
http.CommonHeader.content_length: res.len.str()
|
||||
}).join(ctx.header)
|
||||
|
Reference in New Issue
Block a user