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

ci: fix failing vweb_test.v

This commit is contained in:
Delyan Angelov 2021-08-17 18:36:10 +03:00
parent e1c762a616
commit f96b81b53a
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
4 changed files with 7 additions and 5 deletions

View File

@ -41,7 +41,7 @@ fn main() {
url := 'https://api.caiyunapp.com/v2.5/96Ly7wgKGq6FhllM/116.391912,40.010711/weather.jsonp?hourlysteps=120&random=$rnd' url := 'https://api.caiyunapp.com/v2.5/96Ly7wgKGq6FhllM/116.391912,40.010711/weather.jsonp?hourlysteps=120&random=$rnd'
// println(url) // 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') println('failed to fetch data from the server')
return return
} }

View File

@ -6,7 +6,7 @@ fn main() {
config := http.FetchConfig{ config := http.FetchConfig{
user_agent: 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0' 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') println('failed to fetch data from the server')
return return
} }

View File

@ -23,7 +23,7 @@ fn http_fetch_mock(_methods []string, _config FetchConfig) ?[]Response {
for method in methods { for method in methods {
lmethod := method.to_lower() lmethod := method.to_lower()
config.method = method_from_str(method) config.method = method_from_str(method)
res := fetch(url + lmethod, config) ? res := fetch(FetchConfig{ ...config, url: url + lmethod }) ?
// TODO // TODO
// body := json.decode(HttpbinResponseBody,res.text)? // body := json.decode(HttpbinResponseBody,res.text)?
result << res result << res

View File

@ -212,7 +212,8 @@ Content-Disposition: form-data; name=\"$name\"
$contents $contents
--------------------------$boundary-- --------------------------$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 method: .post
header: http.new_header( header: http.new_header(
key: .content_type key: .content_type
@ -238,7 +239,8 @@ fn test_http_client_shutdown_does_not_work_without_a_cookie() {
fn testsuite_end() { fn testsuite_end() {
// This test is guaranteed to be called last. // This test is guaranteed to be called last.
// It sends a request to the server to shutdown. // 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 method: .get
cookies: { cookies: {
'skey': 'superman' 'skey': 'superman'