diff --git a/chromium.go b/chromium.go index ee76c4c..bf66243 100644 --- a/chromium.go +++ b/chromium.go @@ -98,7 +98,7 @@ func (req *chromiumRequest) FailOnResourceHTTPStatusCodes(statusCodes []int) err return fmt.Errorf("marshal HTTP status codes to JSON: %w", err) } - req.fields[fieldChromiumFailOnHTTPStatusCodes] = string(marshaledStatusCodes) + req.fields[fieldChromiumFailOnResourceHTTPStatusCodes] = string(marshaledStatusCodes) return nil } @@ -237,4 +237,4 @@ func (req *chromiumRequest) ScreenshotOptimizeForSpeed() { // Format sets the image compression format, either PNG, JPEG or WEBP. Default is PNG. func (req *chromiumRequest) Format(format ImageFormat) { req.fields[fieldScreenshotFormat] = string(format) -} \ No newline at end of file +} diff --git a/client.go b/client.go index 7c8aa4e..f57ba48 100644 --- a/client.go +++ b/client.go @@ -18,8 +18,8 @@ var ( errSendRequestFailed = errors.New("request sending failed") ) -// MainRequester is a type for sending form fields and form files (documents) to the Gotenberg API. -type MainRequester interface { +// MultipartRequester is a type for sending form fields and form files (documents) to the Gotenberg API. +type MultipartRequester interface { endpoint() string baseRequester @@ -48,11 +48,11 @@ func NewClient(hostname string, httpClient *http.Client) (*Client, error) { } // Send sends a request to the Gotenberg API and returns the response. -func (c *Client) Send(ctx context.Context, req MainRequester) (*http.Response, error) { +func (c *Client) Send(ctx context.Context, req MultipartRequester) (*http.Response, error) { return c.send(ctx, req) } -func (c *Client) send(ctx context.Context, r MainRequester) (*http.Response, error) { +func (c *Client) send(ctx context.Context, r MultipartRequester) (*http.Response, error) { req, err := c.createRequest(ctx, r, r.endpoint()) if err != nil { return nil, err @@ -67,11 +67,11 @@ func (c *Client) send(ctx context.Context, r MainRequester) (*http.Response, err } // Store creates the resulting file to given destination. -func (c *Client) Store(ctx context.Context, req MainRequester, dest string) error { +func (c *Client) Store(ctx context.Context, req MultipartRequester, dest string) error { return c.store(ctx, req, dest) } -func (c *Client) store(ctx context.Context, req MainRequester, dest string) error { +func (c *Client) store(ctx context.Context, req MultipartRequester, dest string) error { if hasWebhook(req) { return errWebhookNotAllowed } diff --git a/html.go b/html.go index 269bd62..3ba7960 100644 --- a/html.go +++ b/html.go @@ -54,5 +54,5 @@ func (req *HTMLRequest) Assets(assets ...document.Document) { // Compile-time checks to ensure type implements desired interfaces. var ( - _ = MainRequester(new(HTMLRequest)) + _ = MultipartRequester(new(HTMLRequest)) ) diff --git a/libreoffice.go b/libreoffice.go index 6966d25..2d1d9f0 100644 --- a/libreoffice.go +++ b/libreoffice.go @@ -179,5 +179,5 @@ func (req *OfficeRequest) Merge() { // Compile-time checks to ensure type implements desired interfaces. var ( - _ = MainRequester(new(OfficeRequest)) + _ = MultipartRequester(new(OfficeRequest)) ) diff --git a/markdown.go b/markdown.go index fcd6f62..53e776e 100644 --- a/markdown.go +++ b/markdown.go @@ -54,5 +54,5 @@ func (req *MarkdownRequest) Assets(assets ...document.Document) { // Compile-time checks to ensure type implements desired interfaces. var ( - _ = MainRequester(new(MarkdownRequest)) + _ = MultipartRequester(new(MarkdownRequest)) ) diff --git a/metadata_reader.go b/metadata_reader.go index 20ff8fb..f131533 100644 --- a/metadata_reader.go +++ b/metadata_reader.go @@ -31,5 +31,5 @@ func (rmd *ReadMetadataRequest) formDocuments() map[string]document.Document { // Compile-time checks to ensure type implements desired interfaces. var ( - _ = MainRequester(new(ReadMetadataRequest)) + _ = MultipartRequester(new(ReadMetadataRequest)) ) diff --git a/metadata_writer.go b/metadata_writer.go index 3b9235a..62d1b32 100644 --- a/metadata_writer.go +++ b/metadata_writer.go @@ -35,5 +35,5 @@ func (wmd *WriteMetadataRequest) Metadata(md []byte) { // Compile-time checks to ensure type implements desired interfaces. var ( - _ = MainRequester(new(WriteMetadataRequest)) -) \ No newline at end of file + _ = MultipartRequester(new(WriteMetadataRequest)) +) diff --git a/pdfengines.go b/pdfengines.go index 130bf42..972f0a2 100644 --- a/pdfengines.go +++ b/pdfengines.go @@ -48,5 +48,5 @@ func (req *MergeRequest) Metadata(md []byte) { // Compile-time checks to ensure type implements desired interfaces. var ( - _ = MainRequester(new(MergeRequest)) + _ = MultipartRequester(new(MergeRequest)) ) diff --git a/url.go b/url.go index 216406d..75cd864 100644 --- a/url.go +++ b/url.go @@ -42,5 +42,5 @@ func (req *URLRequest) formDocuments() map[string]document.Document { // Compile-time checks to ensure type implements desired interfaces. var ( - _ = MainRequester(new(URLRequest)) + _ = MultipartRequester(new(URLRequest)) )