From f96b81b53a5dce24cad04a000156a1d488ff3f5a Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 17 Aug 2021 18:36:10 +0300 Subject: [PATCH] ci: fix failing vweb_test.v --- examples/get_weather/get_weather.v | 2 +- examples/web_crawler/web_crawler.v | 2 +- vlib/net/http/http_httpbin_test.v | 2 +- vlib/vweb/tests/vweb_test.v | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/get_weather/get_weather.v b/examples/get_weather/get_weather.v index 3156590738..4de057207d 100644 --- a/examples/get_weather/get_weather.v +++ b/examples/get_weather/get_weather.v @@ -41,7 +41,7 @@ fn main() { url := 'https://api.caiyunapp.com/v2.5/96Ly7wgKGq6FhllM/116.391912,40.010711/weather.jsonp?hourlysteps=120&random=$rnd' // println(url) - resp := http.fetch(url, config) or { + resp := http.fetch(http.FetchConfig{ ...config, url: url }) or { println('failed to fetch data from the server') return } diff --git a/examples/web_crawler/web_crawler.v b/examples/web_crawler/web_crawler.v index e32de54a57..00d4dfa0ad 100644 --- a/examples/web_crawler/web_crawler.v +++ b/examples/web_crawler/web_crawler.v @@ -6,7 +6,7 @@ fn main() { config := http.FetchConfig{ user_agent: 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0' } - resp := http.fetch('https://tuicool.com', config) or { + resp := http.fetch(http.FetchConfig{ ...config, url: 'https://tuicool.com' }) or { println('failed to fetch data from the server') return } diff --git a/vlib/net/http/http_httpbin_test.v b/vlib/net/http/http_httpbin_test.v index e40778d8a0..a3ddccc2f3 100644 --- a/vlib/net/http/http_httpbin_test.v +++ b/vlib/net/http/http_httpbin_test.v @@ -23,7 +23,7 @@ fn http_fetch_mock(_methods []string, _config FetchConfig) ?[]Response { for method in methods { lmethod := method.to_lower() config.method = method_from_str(method) - res := fetch(url + lmethod, config) ? + res := fetch(FetchConfig{ ...config, url: url + lmethod }) ? // TODO // body := json.decode(HttpbinResponseBody,res.text)? result << res diff --git a/vlib/vweb/tests/vweb_test.v b/vlib/vweb/tests/vweb_test.v index b9e2283985..b10dad113c 100644 --- a/vlib/vweb/tests/vweb_test.v +++ b/vlib/vweb/tests/vweb_test.v @@ -212,7 +212,8 @@ Content-Disposition: form-data; name=\"$name\" $contents --------------------------$boundary-- " - mut x := http.fetch('http://127.0.0.1:$sport/form_echo', + mut x := http.fetch( + url: 'http://127.0.0.1:$sport/form_echo' method: .post header: http.new_header( key: .content_type @@ -238,7 +239,8 @@ fn test_http_client_shutdown_does_not_work_without_a_cookie() { fn testsuite_end() { // This test is guaranteed to be called last. // It sends a request to the server to shutdown. - x := http.fetch('http://127.0.0.1:$sport/shutdown', + x := http.fetch( + url: 'http://127.0.0.1:$sport/shutdown' method: .get cookies: { 'skey': 'superman'