[MM-37755] Idiomatic naming (SMTP, TLS, TCP, XML, CSS, HTML, HTTP) (#18103)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bd65e8daf9
Коммит
fd853e74a6
@@ -35,7 +35,7 @@ const (
|
||||
HeaderRemoteclusterToken = "X-RemoteCluster-Token"
|
||||
HeaderRemoteclusterId = "X-RemoteCluster-Id"
|
||||
HeaderRequestedWith = "X-Requested-With"
|
||||
HeaderRequestedWithXml = "XMLHttpRequest"
|
||||
HeaderRequestedWithXML = "XMLHttpRequest"
|
||||
HeaderRange = "Range"
|
||||
STATUS = "status"
|
||||
StatusOk = "OK"
|
||||
@@ -62,10 +62,10 @@ type Response struct {
|
||||
type Client4 struct {
|
||||
Url string // The location of the server, for example "http://localhost:8065"
|
||||
ApiUrl string // The api location of the server, for example "http://localhost:8065/api/v4"
|
||||
HttpClient *http.Client // The http client
|
||||
HTTPClient *http.Client // The http client
|
||||
AuthToken string
|
||||
AuthType string
|
||||
HttpHeader map[string]string // Headers to be copied over for each request
|
||||
HTTPHeader map[string]string // Headers to be copied over for each request
|
||||
|
||||
// TrueString is the string value sent to the server for true boolean query parameters.
|
||||
trueString string
|
||||
@@ -131,7 +131,7 @@ func NewAPIv4SocketClient(socketPath string) *Client4 {
|
||||
}
|
||||
|
||||
client := NewAPIv4Client("http://_")
|
||||
client.HttpClient = &http.Client{Transport: tr}
|
||||
client.HTTPClient = &http.Client{Transport: tr}
|
||||
|
||||
return client
|
||||
}
|
||||
@@ -635,13 +635,13 @@ func (c *Client4) doApiRequestReader(method, url string, data io.Reader, headers
|
||||
rq.Header.Set(HeaderAuth, c.AuthType+" "+c.AuthToken)
|
||||
}
|
||||
|
||||
if c.HttpHeader != nil && len(c.HttpHeader) > 0 {
|
||||
for k, v := range c.HttpHeader {
|
||||
if c.HTTPHeader != nil && len(c.HTTPHeader) > 0 {
|
||||
for k, v := range c.HTTPHeader {
|
||||
rq.Header.Set(k, v)
|
||||
}
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
return nil, NewAppError(url, "model.client.connecting.app_error", nil, err.Error(), 0)
|
||||
}
|
||||
@@ -676,7 +676,7 @@ func (c *Client4) doUploadFile(url string, body io.Reader, contentType string, c
|
||||
rq.Header.Set(HeaderAuth, c.AuthType+" "+c.AuthToken)
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
return nil, BuildErrorResponse(rp, NewAppError(url, "model.client.connecting.app_error", nil, err.Error(), 0))
|
||||
}
|
||||
@@ -700,7 +700,7 @@ func (c *Client4) DoEmojiUploadFile(url string, data []byte, contentType string)
|
||||
rq.Header.Set(HeaderAuth, c.AuthType+" "+c.AuthToken)
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
return nil, BuildErrorResponse(rp, NewAppError(url, "model.client.connecting.app_error", nil, err.Error(), 0))
|
||||
}
|
||||
@@ -724,7 +724,7 @@ func (c *Client4) DoUploadImportTeam(url string, data []byte, contentType string
|
||||
rq.Header.Set(HeaderAuth, c.AuthType+" "+c.AuthToken)
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
return nil, BuildErrorResponse(rp, NewAppError(url, "model.client.connecting.app_error", nil, err.Error(), 0))
|
||||
}
|
||||
@@ -1566,7 +1566,7 @@ func (c *Client4) SetProfileImage(userId string, data []byte) (bool, *Response)
|
||||
rq.Header.Set(HeaderAuth, c.AuthType+" "+c.AuthToken)
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
return false, &Response{StatusCode: http.StatusForbidden, Error: NewAppError(c.GetUserRoute(userId)+"/image", "model.client.connecting.app_error", nil, err.Error(), http.StatusForbidden)}
|
||||
}
|
||||
@@ -2402,7 +2402,7 @@ func (c *Client4) SetTeamIcon(teamId string, data []byte) (bool, *Response) {
|
||||
rq.Header.Set(HeaderAuth, c.AuthType+" "+c.AuthToken)
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
// set to http.StatusForbidden(403)
|
||||
return false, &Response{StatusCode: http.StatusForbidden, Error: NewAppError(c.GetTeamRoute(teamId)+"/image", "model.client.connecting.app_error", nil, err.Error(), 403)}
|
||||
@@ -3894,7 +3894,7 @@ func (c *Client4) UploadLicenseFile(data []byte) (bool, *Response) {
|
||||
rq.Header.Set(HeaderAuth, c.AuthType+" "+c.AuthToken)
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
return false, &Response{StatusCode: http.StatusForbidden, Error: NewAppError(c.GetLicenseRoute(), "model.client.connecting.app_error", nil, err.Error(), http.StatusForbidden)}
|
||||
}
|
||||
@@ -4357,7 +4357,7 @@ func (c *Client4) DownloadComplianceReport(reportId string) ([]byte, *Response)
|
||||
rq.Header.Set(HeaderAuth, "BEARER "+c.AuthToken)
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
return nil, &Response{Error: NewAppError("DownloadComplianceReport", "model.client.connecting.app_error", nil, err.Error(), http.StatusBadRequest)}
|
||||
}
|
||||
@@ -4738,7 +4738,7 @@ func (c *Client4) UploadBrandImage(data []byte) (bool, *Response) {
|
||||
rq.Header.Set(HeaderAuth, c.AuthType+" "+c.AuthToken)
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
return false, &Response{StatusCode: http.StatusForbidden, Error: NewAppError(c.GetBrandRoute()+"/image", "model.client.connecting.app_error", nil, err.Error(), http.StatusForbidden)}
|
||||
}
|
||||
@@ -4906,7 +4906,7 @@ func (c *Client4) GetOAuthAccessToken(data url.Values) (*AccessResponse, *Respon
|
||||
rq.Header.Set(HeaderAuth, c.AuthType+" "+c.AuthToken)
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
return nil, &Response{StatusCode: http.StatusForbidden, Error: NewAppError(url, "model.client.connecting.app_error", nil, err.Error(), 403)}
|
||||
}
|
||||
@@ -5832,7 +5832,7 @@ func (c *Client4) uploadPlugin(file io.Reader, force bool) (*Manifest, *Response
|
||||
rq.Header.Set(HeaderAuth, c.AuthType+" "+c.AuthToken)
|
||||
}
|
||||
|
||||
rp, err := c.HttpClient.Do(rq)
|
||||
rp, err := c.HTTPClient.Do(rq)
|
||||
if err != nil || rp == nil {
|
||||
return nil, BuildErrorResponse(rp, NewAppError("UploadPlugin", "model.client.connecting.app_error", nil, err.Error(), 0))
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user