Add socket client4 creation function to the model package (#15067)
Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5be023aa70
Коммит
918fc1d45c
@@ -10,6 +10,7 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"mime/multipart"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
@@ -118,6 +119,19 @@ func NewAPIv4Client(url string) *Client4 {
|
||||
return &Client4{url, url + API_URL_SUFFIX, &http.Client{}, "", "", map[string]string{}, "", ""}
|
||||
}
|
||||
|
||||
func NewAPIv4SocketClient(socketPath string) *Client4 {
|
||||
tr := &http.Transport{
|
||||
Dial: func(network, addr string) (net.Conn, error) {
|
||||
return net.Dial("unix", socketPath)
|
||||
},
|
||||
}
|
||||
|
||||
client := NewAPIv4Client("http://_")
|
||||
client.HttpClient = &http.Client{Transport: tr}
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
func BuildErrorResponse(r *http.Response, err *AppError) *Response {
|
||||
var statusCode int
|
||||
var header http.Header
|
||||
|
||||
Ссылка в новой задаче
Block a user