jdcloud-api / jdcloud-sdk-go Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
如下的代码中使用了硬编码的http.Client,能否使其允许调用方可以传递自定义的http.Client?
func (c JDCloudClient) doSend(method, url, data string, header map[string]string, timeout time.Duration, sign SignFunc) ([]byte, error) {
client := &http.Client{Timeout: timeout}
req, err := http.NewRequest(method, url, strings.NewReader(data))
// ...
}
jdcloud-sdk-go/services/common/models/Sort.go
Lines 25 to 26 in a6e34ad
github.com/jdcloud-api/jdcloud-sdk-go/core/Signer.go:170:11: assignment mismatch: 2 variables but 1 values
京东云文本短信产品,调用批量发送短信方法时遇到响应异常
Unmarshal json failed, resp: %s {"result":{"code":11561102,"data":null,"message":"批量发送短信接口,未找到模板ID对应的数据。","status":false},"requestId":"58ac9346cfda4ec0a118b4eb5b10df5e"}
响应结果result.code为int类型,但是struct定义类型为string类型,最终解析失败
请开发者核实
看到billing 的部分功能比较少,是否有余额获取的接口?
jdcloud-api/jdcloud-sdk-go/core/Signer.go:170:11: assignment mismatch: 2 variables but 1 values
仔细看了一下Signer.go以及它调用的github.com/satori/go.uuid,uuid.NewV4()返回一个参数但,Signer.go中接收参数为2,
$ go1.12.5 run monitor.go
# github.com/jdcloud-api/jdcloud-sdk-go/core
../../../go/pkg/mod/github.com/jdcloud-api/[email protected]/core/Signer.go:170:11: assignment mismatch: 2 variables but uuid.NewV4 returns 1 values
原因:
执行vpc操作时出现如下输出
Content-Type [application/json]
User-Agent [JdcloudSdkGo/1.1.2 vpc/0.5.0]
DEBUG: Request Signature:
---[ CANONICAL STRING ]-----------------------------
GET
/v1/regions/cn-east-2/networkInterfaces/port-pig3p7864x
content-type:application/json
host:vpc.jdcloud-api.com
x-jdcloud-date:20181208T003651Z
x-jdcloud-nonce:32844190-ff6d-4fa1-a1bb-072ce645a26a
{"URL":"/regions/{regionId}/networkInterfaces/{networkInterfaceId}","Method":"GET","Header":null,"Version":"v1","regionId":"cn-east-2","networkInterfaceId":"port-fet9c4pvzt"}
URL=/regions/cn-east-2/networkInterfaces/port-fet9c4pvzt
Content-Type [application/json]
User-Agent [JdcloudSdkGo/1.1.2 vpc/0.5.0]
DEBUG: Request Signature:
---[ CANONICAL STRING ]-----------------------------
GET
/v1/regions/cn-east-2/networkInterfaces/port-fet9c4pvzt
content-type:application/json
host:vpc.jdcloud-api.com
x-jdcloud-date:20181208T003651Z
x-jdcloud-nonce:3d15d3e1-bf3a-40c5-8b75-364c0c442cf4
如何关闭以下输出?
jdResp := &PutBucketResponse{}
err = json.Unmarshal(resp, jdResp)
return jdResp, err
改为
jdResp := &PutBucketResponse{}
err = json.Unmarshal(resp, jdResp)
if err != nil {
return nil, err
}
return jdResp, err
参考oss_test.go文件,调用client的相关接口ListBuckets(req)或者HeadBucket(req),均返回失败。返回错误提示信息:"invalid character '<' looking for beginning of value",不太明白这个返回信息具体是什么意思.与此同时我测试了vm client函数调用,功能基本正常。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.