mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
http: add post function with json as payload (#5580)
This commit is contained in:
parent
d091f4e5b2
commit
f3010cbfb2
@ -75,6 +75,15 @@ pub fn post(url, data string) ?Response {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn post_json(url, data string) ?Response {
|
||||||
|
return fetch_with_method('POST', url, {
|
||||||
|
data: data
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn post_form(url string, data map[string]string) ?Response {
|
pub fn post_form(url string, data map[string]string) ?Response {
|
||||||
return fetch_with_method('POST', url, {
|
return fetch_with_method('POST', url, {
|
||||||
headers: {
|
headers: {
|
||||||
|
Loading…
Reference in New Issue
Block a user