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

net.http: Response.text -> Response.body (#14478)

This commit is contained in:
Hunam
2022-05-29 19:27:18 +02:00
committed by GitHub
parent 2c5febe25e
commit 78d1b7f4ef
19 changed files with 65 additions and 74 deletions

View File

@@ -25,7 +25,7 @@ fn http_fetch_mock(_methods []string, _config FetchConfig) ?[]Response {
config.method = method_from_str(method)
res := fetch(FetchConfig{ ...config, url: url + lmethod })?
// TODO
// body := json.decode(HttpbinResponseBody,res.text)?
// body := json.decode(HttpbinResponseBody,res.body)?
result << res
}
return result
@@ -49,7 +49,7 @@ fn test_http_fetch_with_data() {
data: 'hello world'
) or { panic(err) }
for response in responses {
payload := json.decode(HttpbinResponseBody, response.text) or { panic(err) }
payload := json.decode(HttpbinResponseBody, response.body) or { panic(err) }
assert payload.data == 'hello world'
}
}
@@ -65,7 +65,7 @@ fn test_http_fetch_with_params() {
}
) or { panic(err) }
for response in responses {
// payload := json.decode(HttpbinResponseBody,response.text) or {
// payload := json.decode(HttpbinResponseBody,response.body) or {
// panic(err)
// }
assert response.status() == .ok
@@ -85,7 +85,7 @@ fn test_http_fetch_with_headers() ? {
header: header
) or { panic(err) }
for response in responses {
// payload := json.decode(HttpbinResponseBody,response.text) or {
// payload := json.decode(HttpbinResponseBody,response.body) or {
// panic(err)
// }
assert response.status() == .ok