How to send post request message from the group Vkontakte?

In Python previously, when sending a message on behalf of the Vkontakte group was doing a Get request and have listed the methods in the method message just gave the line. In Go it is not roll, because there's get request does not understand the gaps, it is necessary for each gap to put the " + " to send more than one word in the message, but it's a chore. Never had to deal with post requests. Tell me how can I make a post request to send a specific message from the group on the specified user_id please.
April 19th 20 at 12:09
1 answer
April 19th 20 at 12:11
Solution
package main

import (
"fmt"
"log"
"net/http"
"os"
)

func main() {
 req, err := http.NewRequest("GET", "http://****", nil)
 if err != nil {
log.Print(err)
os.Exit(1)
}

 q := req.URL.Query()
 q.Add("api_key", "key_from_environment_or_flag")
 q.Add("another_thing", "foo & bar")
 req.URL.RawQuery = q.Encode()

fmt.Println(req.URL.String())
 // http://***?another_thing=foo+%26+bar&api_key=key_from_environment_or_flag
}
I told you it's a chore, I think post will be clearer to understand like) - Alysson_Legr commented on April 19th 20 at 12:14
@Alysson_Legr, what a chore? Address and options, and gets you all the parameters of the write together with the address and post separately - Zande commented on April 19th 20 at 12:17
It's not a chore. It's readable, it's controlled, it's safe. - and commented on April 19th 20 at 12:20
@and, but why is not working) - Alysson_Legr commented on April 19th 20 at 12:23
@and, the program fulfills without errors, but the messages don't come as well, although if you use the link, which gives the program in the browser, it works. But the program itself does not want to send. - Alysson_Legr commented on April 19th 20 at 12:26
If you add
http.Get(req.URL.String())
that triggers the dispatch. - Alysson_Legr commented on April 19th 20 at 12:29
What's the matter? In itself is not sent or what? - Alysson_Legr commented on April 19th 20 at 12:32
@Alysson_Legr, In the example only to make a request. Of course it needs to send. How is he a go. - and commented on April 19th 20 at 12:35
Thank you all/) - Alysson_Legr commented on April 19th 20 at 12:38

Find more questions by tags VKontakteGo