คำถามติดแท็ก apiary

4
ฉันจะส่งสตริง JSON ในคำขอ POST ใน Go ได้อย่างไร
ฉันพยายามทำงานกับ Apiary และสร้างแม่แบบสากลเพื่อส่ง JSON ไปยังเซิร์ฟเวอร์จำลองและมีรหัสนี้: package main import ( "encoding/json" "fmt" "github.com/jmcvetta/napping" "log" "net/http" ) func main() { url := "http://restapi3.apiary.io/notes" fmt.Println("URL:>", url) s := napping.Session{} h := &http.Header{} h.Set("X-Custom-Header", "myvalue") s.Header = h var jsonStr = []byte(` { "title": "Buy cheese and bread for breakfast." }`) var data map[string]json.RawMessage …
244 json  rest  go  apiary 
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.