Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

29 linhas
631 B

  1. package apiclient
  2. import (
  3. "fmt"
  4. "net/http"
  5. "strings"
  6. "github.com/AFASystems/presence/internal/pkg/config"
  7. )
  8. func setHeader(req *http.Request, token string) {
  9. req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))
  10. }
  11. func getRequest(token, route string, client *http.Client, cfg *config.Config) (*http.Response, error) {
  12. url := fmt.Sprintf("%s/reslevis/%s", cfg.APIBaseURL, route)
  13. req, err := http.NewRequest("GET", url, nil)
  14. if err != nil {
  15. return nil, err
  16. }
  17. setHeader(req, token)
  18. return client.Do(req)
  19. }
  20. func convertMac(mac string) string {
  21. return strings.ToUpper(strings.ReplaceAll(mac, ":", ""))
  22. }