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

http: send headers and request data

This commit is contained in:
Delyan Angelov
2019-08-25 01:48:06 +03:00
committed by Alexander Medvednikov
parent 57880aed18
commit a62e6b127a
4 changed files with 29 additions and 18 deletions

View File

@ -3,11 +3,11 @@ module http
import net
import strings
fn http_do(port int, method, host_name, path string) ?Response {
fn (req &Request) http_do(port int, method, host_name, path string) ?Response {
bufsize := 512
rbuffer := [512]byte
mut sb := strings.new_builder(100)
s := build_request_headers('', method, host_name, path)
s := req.build_request_headers(method, host_name, path)
client := net.dial( host_name, port) or { return error(err) }
client.send( s.str, s.len )