Module: Gotenberg::Headers

Included in:
Chromium, Libreoffice, PdfEngines
Defined in:
lib/gotenberg/headers.rb

Instance Method Summary collapse

Instance Method Details

#trace(trace, header = 'Gotenberg-Trace') ⇒ Object

Overrides the default UUID trace, or request ID, that identifies a request in Gotenberg’s logs.



38
39
40
41
42
# File 'lib/gotenberg/headers.rb', line 38

def trace trace, header = 'Gotenberg-Trace'
  headers[header] = trace

  self
end

#webhook(url, error_url) ⇒ Object

Sets the callback and error callback that Gotenberg will use to send respectively the output file and the error response.



7
8
9
10
11
12
# File 'lib/gotenberg/headers.rb', line 7

def webhook url, error_url
  headers['Gotenberg-Webhook-Url'] = url
  headers['Gotenberg-Webhook-Error-Url'] = error_url

  self
end

#webhook_error_method(method) ⇒ Object

Overrides the default HTTP method that Gotenberg will use to call the error webhook. Either “POST”, “PATCH”, or “PUT” - default “POST”.



24
25
26
27
28
# File 'lib/gotenberg/headers.rb', line 24

def webhook_error_method method
  headers['Gotenberg-Webhook-Error-Method'] = method

  self
end

#webhook_extra_http_headers(headers) ⇒ Object

Sets the extra HTTP headers that Gotenberg will send alongside the request to the webhook and error webhook.



31
32
33
34
35
# File 'lib/gotenberg/headers.rb', line 31

def webhook_extra_http_headers headers
  headers['Gotenberg-Webhook-Extra-Http-Headers'] = headers.to_json

  self
end

#webhook_method(method) ⇒ Object

Overrides the default HTTP method that Gotenberg will use to call the webhook. Either “POST”, “PATCH”, or “PUT” - default “POST”.



16
17
18
19
20
# File 'lib/gotenberg/headers.rb', line 16

def webhook_method method
  headers['Gotenberg-Webhook-Method'] = method

  self
end