From fc628f2ee9fb3574a5d8c4dbea01bdbccd0254b2 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 26 Jun 2019 17:45:48 +0200 Subject: [PATCH] http: public functions --- http/http.v | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/http/http.v b/http/http.v index c31f22137f..cfff055056 100644 --- a/http/http.v +++ b/http/http.v @@ -28,7 +28,7 @@ pub: } // embed 'http' -fn get(url string) string { +pub fn get(url string) string { if url == '' { println('http: empty get url') return '' @@ -38,17 +38,13 @@ fn get(url string) string { return resp.body } -fn get2(url string) string { - return '' -} - -fn post(url, data string) string { +pub fn post(url, data string) string { req := new_request('POST', url, data) resp := req.do() return resp.body } -fn new_request(typ, _url, _data string) *Request { +pub fn new_request(typ, _url, _data string) *Request { mut url := _url mut data := _data // req.headers['User-Agent'] = 'V $VERSION' @@ -82,7 +78,7 @@ fn (resp mut Response) free() { resp.headers.free() } -fn (req mut Request) add_header(key, val string) { +pub fn (req mut Request) add_header(key, val string) { // println('start add header') // println('add header "$key" "$val"') // println(key)