|
@@ -3,7 +3,6 @@ package discourse
|
|
import (
|
|
import (
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"fmt"
|
|
"fmt"
|
|
- "net/http"
|
|
|
|
"strings"
|
|
"strings"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -28,9 +27,11 @@ type User struct {
|
|
|
|
|
|
// GetUser - Get a discourse user
|
|
// GetUser - Get a discourse user
|
|
func GetUser(config APIConfig, username string) (User, error) {
|
|
func GetUser(config APIConfig, username string) (User, error) {
|
|
- url := fmt.Sprintf("%s/users/%s.json?api_key=%s&api_username=%s", config.Endpoint, username, config.APIKey, config.APIUsername)
|
|
|
|
|
|
+ url := fmt.Sprintf("%s/users/%s.json", config.Endpoint, username)
|
|
|
|
|
|
- response, _ := http.Get(url)
|
|
|
|
|
|
+ req, _ := newGetRequest(config, url)
|
|
|
|
+ client := getClient()
|
|
|
|
+ response, _ := client.Do(req)
|
|
|
|
|
|
var result *UserResponse
|
|
var result *UserResponse
|
|
json.NewDecoder(response.Body).Decode(&result)
|
|
json.NewDecoder(response.Body).Decode(&result)
|