Go to file
2024-10-16 18:08:06 +08:00
.gitignore 1 2024-10-15 10:45:04 +08:00
go.mod 1 2024-10-15 10:45:04 +08:00
http_test.go 1 2024-10-15 10:45:04 +08:00
http.go update ws 2024-10-16 18:08:06 +08:00
http.ts update ws 2024-10-16 18:08:06 +08:00
LICENSE 1 2024-10-15 10:45:04 +08:00
README.md 1 2024-10-15 10:45:04 +08:00
ws_test.js update ws 2024-10-16 18:08:06 +08:00

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

full api see http.ts