douju4594
2018-12-01 10:52golang http.Post请求返回响应404
I have written a go code to create a issue in a project in my github reposiory. I am using parameters as mentioned here [https://developer.github.com/v3/issues/#create-an-issue][1]
But I am getting response with status 404. Below is my code.
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
param := map[string]string{"title": "issue1", "body": "aassddrff", "assignee": "vigneshkm"}
query, _ := json.Marshal(param)
queryUrl := "https://api.github.com/repos/vigneshkm/first_repo/issues"
fmt.Println("query:", string(query))
resp, err := http.Post(queryUrl, "application/json", bytes.NewBuffer(query))
fmt.Println("query_status : ", resp.StatusCode, "err : ", err)
resp.Body.Close()
}
I am a beginner to web programming and I am not able to understand my mistake in this code. Kindly help me :)
- 点赞
- 回答
- 收藏
- 复制链接分享
2条回答
为你推荐
- http请求会自动重试吗?
- http
- 1个回答
- Golang http写响应而无需等待完成
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 3个回答
- golang http.Post请求返回响应404
- http
- http-post
- 2个回答
- Go-http.Post方法返回400 Bad Request,而http.Get似乎有效
- http
- post
- 2个回答
- Golang Lambda中的快速重新发送响应
- performance
- 1个回答
换一换