This repository has been archived by the owner on Apr 14, 2024. It is now read-only.
Releases: thecodingmachine/gotenberg-go-client
Releases · thecodingmachine/gotenberg-go-client
7.2.0
7.1.0
7.0.1
7.0.0
This release upgrades the client for Gotenberg 6.1.0.
New features
Custom HTTP headers
# remote URL
req := NewURLRequest("http://google.com")
req.AddRemoteURLHTTPHeader("A-Header", "Foo")
# webhook URL
req := NewURLRequest("http://google.com")
req.WebhookURL("https://a-site.com/webhook")
req.AddWebhookURLHTTPHeader("A-Header", "Foo")
Page ranges
req := NewURLRequest("http://google.com")
req.PageRanges("1-1")
Document from a path, raw text, bytes (breaking change)
Before:
req, _ := gotenberg.NewHTMLRequest("index.html")
Now:
// from a path.
index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file")
// ... or from a string.
index, _ := gotenberg.NewDocumentFromString("index.html", "<html>Foo</html>")
// ... or from bytes.
index, _ := gotenberg.NewDocumentFromBytes("index.html", []byte("<html>Foo</html>"))
req := gotenberg.NewHTMLRequest(index)
Fixes #9.
Specify your own HTTP client
Before:
client := &gotenberg.Client{Hostname: "http://localhost:3000"}
Now:
client := &gotenberg.Client{Hostname: "http://localhost:3000"}
// ... or use your own *http.Client.
httpClient := &http.Client{
Timeout: time.Duration(5) * time.Second,
}
client := &gotenberg.Client{Hostname: "http://localhost:3000", HTTPClient: httpClient}
Fixes #11.
Improvements
- Improved README
6.0.2
This release fixes the function func (c *Client) Store(req Request, dest string) error
.
It now returns an error if response code from the API is not 200.
Thanks @chetanyakan 👍