How do I send the post in GoLang?
I have the following code in
ruby, now I need to transfer into Golang.
http = Net::HTTP.new('example.com', 443) http.use_ssl = true http path = '/abc/login' data = 'data[Account][username]=myusername&data[Account][passwd]=mypassword' resp, _ = http.post(path, data)
This way, I can get the cookie after login request.
But I don't know how to send a post request in Go.
I've written the following code.
path := "https://example.com/abc/login" data := strings.NewReader("data[Account][username]=myusername&data[Account][passwd]=mypassword") resp, err := http.Post(path, "text/html; charset=UTF-8", data)
It seems not correct, because I didn't find a way to get cookie.