You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
voicebot/testhttpclient/testhttpclient.go

60 lines
1.4 KiB
Go

package main
import (
"fmt"
"unsafe"
)
type ServiceInfoBody struct {
CustTel string `json:"custTel"`
}
func main() {
var i int
var i32 int32
var ui32 uint32
var i64 uint64
var ui64 uint64
fmt.Printf("int size : %d\n", unsafe.Sizeof(i))
fmt.Printf("int32 size : %d\n", unsafe.Sizeof(i32))
fmt.Printf("uint32 size : %d\n", unsafe.Sizeof(ui32))
fmt.Printf("int64 size : %d\n", unsafe.Sizeof(i64))
fmt.Printf("uint64 size : %d\n", unsafe.Sizeof(ui64))
/*
svcInfoBody := ServiceInfoBody{CustTel: "0220229013"}
b, err := json.Marshal(svcInfoBody)
if err != nil {
fmt.Println(">>> json marshal error", err)
return
}
body := bytes.NewBuffer(b)
fmt.Println(body)
client := icshttpclient.NewIcsHttpClient("POST", "http://15.165.95.232:8080/platform/api/call/serviceInfo", body)
if client == nil {
fmt.Println("http client error")
return
}
client.Request.Header.Add("Content-Type", "application/json;charset=UTF-8")
resp, err := client.Do(client.Request)
if err != nil {
fmt.Println("http request error", err)
return
}
//resBody := make([]byte, resp.ContentLength)
//resp.Body.Read(resBody)
resBody, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
}
fmt.Println("Response>")
fmt.Println(string(resBody))
fmt.Println("====================")
fmt.Printf("%+v\n", resp)
resp.Body.Close()
resBody = nil
*/
}