diff --git a/.env.example b/.env.example index cca0507..25a1e53 100644 --- a/.env.example +++ b/.env.example @@ -9,4 +9,4 @@ IS_CAPTCHA_ACTIVE=true GATEWAY_URL=http://localhost:3001 GATEWAY_API_KEY=example GATEWAY_BOARD_ID=b -GATEWAY_BOARD_DESCRIPTION="Random" \ No newline at end of file +GATEWAY_BOARD_DESCRIPTION=Random \ No newline at end of file diff --git a/main.go b/main.go index f46ab5b..1301dff 100644 --- a/main.go +++ b/main.go @@ -78,8 +78,15 @@ func main() { "id": Config.App.Gateway.BoardId, "description": Config.App.Gateway.BoardDescription, }) - requestBodyBuffer := bytes.NewBuffer(requestBody) - resp, err := http.Post(Config.App.Gateway.Url+"/boards", "application/json", requestBodyBuffer) + url := Config.App.Gateway.Url + "/boards" + req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody)) + if err != nil { + log.Panicln(err) + } + req.Header.Set("Authorization", Config.App.Gateway.ApiKey) + req.Header.Set("Content-Type", "application/json") + client := &http.Client{} + resp, err := client.Do(req) if err != nil { log.Panicln(err) }