瀏覽代碼

http RAW can take optional data body.

master
Patrick Peng Sun 8 年之前
父節點
當前提交
a67c242814
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. +5
    -1
      upload.go

+ 5
- 1
upload.go 查看文件

@@ -70,7 +70,11 @@ func putRAW(data []byte, targetURL string, headers map[string]string) (resp stri
}

func httpRaw(httpMethod, targetURL string, data []byte, headers map[string]string) (resp string, err error) {
req, err := http.NewRequest(httpMethod, targetURL, bytes.NewBuffer(data))
requestBody := io.Reader(nil)
if data != nil {
requestBody = bytes.NewBuffer(data)
}
req, err := http.NewRequest(httpMethod, targetURL, requestBody)
if err != nil {
return
}

Loading…
取消
儲存