本文整理汇总了Golang中github.com/tgulacsi/s3weed/s3intf.Owner.CalcHash方法的典型用法代码示例。如果您正苦于以下问题:Golang Owner.CalcHash方法的具体用法?Golang Owner.CalcHash怎么用?Golang Owner.CalcHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tgulacsi/s3weed/s3intf.Owner
的用法示例。
在下文中一共展示了Owner.CalcHash方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: doReq
func doReq(t *testing.T, method, path string, body io.Reader, check ResponseChecker) {
req, err := http.NewRequest(method, path, body)
if err != nil {
t.Fatalf("cannot create request: " + err.Error())
}
req.Host = serviceHost
//req.URL.Host = req.Host
var o s3intf.Owner
for i, b := range backers {
if o, err = b.GetOwner("test"); err != nil {
t.Errorf("cannot get owner for test: %s", err)
continue
}
if Debug {
log.Printf("===")
s3intf.Debug = Debug
}
bts := s3intf.GetBytesToSign(req, serviceHost)
if Debug {
log.Printf("bts: %q", bts)
log.Printf("---")
}
t.Logf("owner: %s bts=%q", o, bts)
actsign := b64.EncodeToString(o.CalcHash(bts))
req.Header.Set("Authorization", "AWS test:"+actsign)
rw := httptest.NewRecorder()
handlers[i].ServeHTTP(rw, req)
if check != nil {
if err = check(rw); err != nil {
t.Fatalf("bad response for %s %s: %s (body:%q)", method, path,
err.Error(), rw.Body.Bytes())
}
}
}
}