本文整理汇总了Golang中github.com/qiniu/api/rs.GetPolicy.MakeRequest方法的典型用法代码示例。如果您正苦于以下问题:Golang GetPolicy.MakeRequest方法的具体用法?Golang GetPolicy.MakeRequest怎么用?Golang GetPolicy.MakeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/qiniu/api/rs.GetPolicy
的用法示例。
在下文中一共展示了GetPolicy.MakeRequest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: downloadUrl
//download
func downloadUrl(domain, key string) string {
baseUrl := rs.MakeBaseUrl(domain, key)
//baseUrl = baseUrl + "?pm3u8/0/e/1438162783"
baseUrl = baseUrl + "?avinfo"
policy := rs.GetPolicy{}
return policy.MakeRequest(baseUrl, nil)
}
示例2: TestPrivateImageView
func TestPrivateImageView(t *testing.T) {
//首先上传一个图片 用于测试
policy := rs.PutPolicy{
Scope: bucket + ":" + key,
}
err := io.PutFile(nil, nil, policy.Token(nil), key, localFile, nil)
if err != nil {
t.Errorf("TestPrivateImageView failed: %v", err)
return
}
rawUrl := makeUrl(key)
iv := ImageView{
Mode: 2,
Height: 250,
Quality: 80,
}
imageViewUrl := iv.MakeRequest(rawUrl)
p := rs.GetPolicy{}
imageViewUrlWithToken := p.MakeRequest(imageViewUrl, nil)
resp, err := http.DefaultClient.Get(imageViewUrlWithToken)
if err != nil {
t.Errorf("TestPrivateImageView failed: %v", err)
return
}
defer resp.Body.Close()
if (resp.StatusCode / 100) != 2 {
t.Errorf("TestPrivateImageView failed: resp.StatusCode = %v", resp.StatusCode)
return
}
}
示例3: handleReturn
func handleReturn(w http.ResponseWriter, req *http.Request) {
ret := req.FormValue("upload_ret")
b, err := base64.URLEncoding.DecodeString(ret)
if err != nil {
w.WriteHeader(404)
return
}
var uploadRet UploadRet
err = json.Unmarshal(b, &uploadRet)
if err != nil {
w.WriteHeader(404)
return
}
policy := rs.GetPolicy{Scope: "*/" + uploadRet.Key}
img := policy.MakeRequest(rs.MakeBaseUrl(DOMAIN, uploadRet.Key))
returnPage := fmt.Sprintf(returnPageFmt, string(b), img, img)
w.Write([]byte(returnPage))
}
示例4: downloadUrl
func downloadUrl(domain, key string) string {
baseUrl := rs.MakeBaseUrl(domain, key)
policy := rs.GetPolicy{}
return policy.MakeRequest(baseUrl, mac)
}
示例5: GetQiniuPrivateDownloadUrl
func GetQiniuPrivateDownloadUrl(domain, key string) string {
baseUrl := rs.MakeBaseUrl(domain, key)
policy := rs.GetPolicy{}
return policy.MakeRequest(baseUrl, nil)
}
示例6: GetUrl
func GetUrl(key string) string {
baseUrl := rs.MakeBaseUrl(DOWNLOAD_URL, key)
getPolicy := rs.GetPolicy{}
return getPolicy.MakeRequest(baseUrl, nil)
}