[MM-14521] New endpoint to validate site urls (#11944)

Этот коммит содержится в:
threepwood-mm
2019-09-06 12:52:14 +02:00
коммит произвёл Ben Schumacher
родитель 451982f9d3
Коммит f9d9dd8b60
5 изменённых файлов: 100 добавлений и 0 удалений

Просмотреть файл

@@ -268,6 +268,10 @@ func (c *Client4) GetTestEmailRoute() string {
return fmt.Sprintf("/email/test")
}
func (c *Client4) GetTestSiteURLRoute() string {
return fmt.Sprintf("/site_url/test")
}
func (c *Client4) GetTestS3Route() string {
return fmt.Sprintf("/file/s3_test")
}
@@ -2912,6 +2916,18 @@ func (c *Client4) TestEmail(config *Config) (bool, *Response) {
return CheckStatusOK(r), BuildResponse(r)
}
// TestSiteURL will test the validity of a site URL.
func (c *Client4) TestSiteURL(siteURL string) (bool, *Response) {
requestBody := make(map[string]string)
requestBody["site_url"] = siteURL
r, err := c.DoApiPost(c.GetTestSiteURLRoute(), MapToJson(requestBody))
if err != nil {
return false, BuildErrorResponse(r, err)
}
defer closeBody(r)
return CheckStatusOK(r), BuildResponse(r)
}
// TestS3Connection will attempt to connect to the AWS S3.
func (c *Client4) TestS3Connection(config *Config) (bool, *Response) {
r, err := c.DoApiPost(c.GetTestS3Route(), config.ToJson())