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

Conversation

@gulien
Copy link
Contributor

@gulien gulien commented Dec 9, 2019

This PR 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

@gulien gulien changed the title WIP: 6.1.0 WIP: v7 (Gotenberg 6.1.0) Dec 10, 2019
@gulien gulien changed the title WIP: v7 (Gotenberg 6.1.0) v7 (Gotenberg 6.1.0) Dec 10, 2019
@gulien gulien merged commit 2fd4d87 into master Dec 10, 2019
@gulien gulien deleted the 6.1.0 branch December 10, 2019 15:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please use http client with timeouts Request to reference html, header/footer and css documents with raw html text variable - go client

2 participants