Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

7.0.0

Compare
Choose a tag to compare
@gulien gulien released this 10 Dec 15:16
· 8 commits to master since this release
2fd4d87

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