mirror of
https://github.com/yanislav-igonin/micrach
synced 2025-04-18 19:00:33 +03:00
feat: add auth header for gateway request
This commit is contained in:
parent
6fea2e3331
commit
124c524e78
@ -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"
|
||||
GATEWAY_BOARD_DESCRIPTION=Random
|
11
main.go
11
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user