Created
December 25, 2021 15:39
-
-
Save daipresents/52a9ac9cdd179036b5b41d75d9e5b727 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
base64 "encoding/base64" | |
"os" | |
"strings" | |
"net/http" | |
"io/ioutil" | |
) | |
func main() { | |
auth := "key:" + os.Getenv("MABL_API_KEY") | |
token := base64.StdEncoding.EncodeToString([]byte(auth)) | |
url := "https://api.mabl.com/events/deployment" | |
payload := strings.NewReader("{\"plan_overrides\":{\"http_headers\":[{\"name\":\"Content-Type\",\"value\":\"application/json\",\"log_header_value\":true}],\"actions\":{\"rebaseline_images\":true,\"set_static_baseline\":true},\"properties\":{\"repository_url\":\"[email protected]:daipresents/test-automation-sandbox.git\"},\"uri\":\"https://create-top-page--test-automation-sandbox.netlify.app/\",\"credentials_required\":false,\"http_auth_credentials_required\":false,\"revision\":\"6da4dde\"},\"environment_id\":\"bIIfJiJ4lefJcKozgmNBPw-e\",\"application_id\":\"Kew3dKp0yhv4MDOPXGNu7w-a\"}") | |
req, _ := http.NewRequest("POST", url, payload) | |
req.Header.Add("Accept", "application/json") | |
req.Header.Add("Content-Type", "application/json") | |
req.Header.Add("Authorization", "Basic " + token) | |
res, _ := http.DefaultClient.Do(req) | |
defer res.Body.Close() | |
body, _ := ioutil.ReadAll(res.Body) | |
fmt.Println(res) | |
fmt.Println(string(body)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment