Преглед изворни кода

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 Прегледај датотеку

} }


func httpRaw(httpMethod, targetURL string, data []byte, headers map[string]string) (resp string, err error) { 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 { if err != nil {
return return
} }

Loading…
Откажи
Сачувај