mholt/curl-to-go

Flags -G -d works incorrectly

Open

#53 opened on Jun 27, 2022

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (168 forks)github user discovery
help wanted

Repository metrics

Stars
 (1,824 stars)
PR merge metrics
 (PR metrics pending)

Description

Are you requesting support for a new curl flag? If so, what is the flag and the equivalent Go code?

curl -G https://curl-to-go.com \
 -d "id=8a829417567d952801568d9d9e3c0b84" \
 -H "Authorization: Bearer OGE4Mjk0MTc1NjdkOTUyODAxNTY4ZDlkOWU5ZjBiODh8amF5MjdhdDVzMg=="
params := url.Values{
		"id": {"8a829417567d952801568d9d9e3c0b84"},
	}

	reqUrl := "https://curl-to-go.com?" + params.Encode()

	req, err := http.NewRequest(http.MethodGet, reqUrl, nil)
	if err != nil {
		// handle err
	}

	req.Header.Set("Authorization", "Bearer OGFjN2E0Yzc4MTZmYjJmNjAxODE2ZmRmMmFjMzAwYTJ8NVF4ZmtDcWZqSA==")

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		// handle err
	}
	defer resp.Body.Close()

Contributor guide