http for GoJS
usage
import (
"apigo.cc/gojs"
_ "apigo.cc/gojs/http"
)
func main() {
r, err := gojs.Run(`
import http from 'apigo.cc/gojs/http'
function main(args){
return http.get('http://......')
}
`, "test.js")
fmt.Println(r, err)
}
websocket
import http from 'apigo.cc/gojs/http'
let conn http.connect('ws://......')
conn.write('hello world')
let r = conn.read()
conn.close()
module.exports
function new(config?: Config): Client
function newH2C(config?: Config): Client
function get(url: string, headers?: Object): Result
function head(url: string, headers?: Object): Result
function post(url: string, data: any, headers?: Object): Result
function put(url: string, data: any, headers?: Object): Result
function delete(url: string, data: any, headers?: Object): Result
function do(method: string, url: string, data: any, callback?: (data: string) => void, headers?: Object): Result
function upload(url: string, form: Object, files: Object, headers?: Object): Result
function download(filename: string, url: string, callback?: (finished: number, total: number) => void, headers?: Object): Result
function connect(url: string, config?: WSConfig): WS