Skip to content

Commit

Permalink
Declare and assign request body struct using shorthand
Browse files Browse the repository at this point in the history
  • Loading branch information
m7kvqbe1 committed Mar 14, 2024
1 parent b4363af commit f8c9cc7
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,15 @@ func sendText(number string, key string) {
wg.Add(1)
defer wg.Done()

type RequestBody struct {
reqJSON, err := json.Marshal(&struct {
Phone string `json:"phone"`
Message string `json:"message"`
Key string `json:"key"`
}

reqBody := &RequestBody{
}{
Phone: number,
Message: "BUY DI TIKITZ!!!",
Key: key,
}

reqJSON, err := json.Marshal(reqBody)
})
if err != nil {
log.Println("Error encoding request body:", err)
return
Expand Down

0 comments on commit f8c9cc7

Please sign in to comment.