1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tools: add cmd/tools/show_ancient_deprecations.v, to cleanup ancient functionality, deprecated over an year ago (#18946)

This commit is contained in:
Delyan Angelov
2023-07-22 19:13:58 +03:00
committed by GitHub
parent 7451178c45
commit 41f99c1abf
9 changed files with 77 additions and 159 deletions

View File

@@ -179,13 +179,6 @@ pub fn url_encode_form_data(data map[string]string) string {
return pieces.join('&')
}
[deprecated: 'use fetch()']
fn fetch_with_method(method Method, _config FetchConfig) !Response {
mut config := _config
config.method = method
return fetch(config)
}
fn build_url_from_fetch(config FetchConfig) !string {
mut url := urllib.parse(config.url)!
if config.params.len == 0 {
@@ -202,23 +195,3 @@ fn build_url_from_fetch(config FetchConfig) !string {
url.raw_query = query
return url.str()
}
[deprecated: 'unescape_url is deprecated, use urllib.query_unescape() instead']
pub fn unescape_url(s string) string {
panic('http.unescape_url() was replaced with urllib.query_unescape()')
}
[deprecated: 'escape_url is deprecated, use urllib.query_escape() instead']
pub fn escape_url(s string) string {
panic('http.escape_url() was replaced with urllib.query_escape()')
}
[deprecated: 'unescape is deprecated, use urllib.query_escape() instead']
pub fn unescape(s string) string {
panic('http.unescape() was replaced with http.unescape_url()')
}
[deprecated: 'escape is deprecated, use urllib.query_unescape() instead']
pub fn escape(s string) string {
panic('http.escape() was replaced with http.escape_url()')
}

View File

@@ -10,7 +10,6 @@ import strconv
pub struct Response {
pub mut:
body string
text string [deprecated: 'use Response.body instead'; deprecated_after: '2022-10-03']
header Header
status_code int
status_msg string
@@ -50,7 +49,6 @@ pub fn parse_response(resp string) !Response {
status_msg: status_msg
header: header
body: body
text: body // TODO: remove as depreciated
}
}
@@ -118,14 +116,13 @@ pub struct ResponseConfig {
status Status = .ok
header Header
body string
text string [deprecated: 'use ResponseConfig.body instead'; deprecated_after: '2022-10-03']
}
// new_response creates a Response object from the configuration. This
// function will add a Content-Length header if body is not empty.
pub fn new_response(conf ResponseConfig) Response {
mut resp := Response{
body: conf.body + conf.text
body: conf.body
header: conf.header
}
if resp.body.len > 0 && !resp.header.contains(.content_length) {

View File

@@ -3,7 +3,7 @@ module http
fn test_response_bytestr_1() {
resp := new_response(
status: .ok
text: 'Foo' // TODO: replace with `body` once deprecaped
body: 'Foo'
)
assert resp.bytestr() == 'HTTP/1.1 200 OK\r\n' + 'Content-Length: 3\r\n' + '\r\n' + 'Foo'
}
@@ -43,5 +43,4 @@ fn test_parse_response() {
assert x.header.contains(.content_length)
assert x.header.get(.content_length)! == '3'
assert x.body == 'Foo'
assert x.text == 'Foo'
}