add upstream context to weasyprint html generation
This commit is contained in:
parent
a8f2274939
commit
77744f510e
1 changed files with 15 additions and 3 deletions
|
@ -20,9 +20,21 @@ module Administrateurs
|
|||
format.pdf do
|
||||
html = render_to_string('/administrateurs/attestation_template_v2s/show', layout: 'attestation', formats: [:html])
|
||||
|
||||
result = Typhoeus.post(WEASYPRINT_URL,
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: { html: html }.to_json)
|
||||
headers = {
|
||||
'Content-Type' => 'application/json',
|
||||
'X-Request-Id' => Current.request_id
|
||||
}
|
||||
|
||||
body = {
|
||||
html: html,
|
||||
upstream_context: {
|
||||
procedure_id: @procedure.id,
|
||||
path: request.path,
|
||||
user_id: current_user.id
|
||||
}
|
||||
}.to_json
|
||||
|
||||
result = Typhoeus.post(WEASYPRINT_URL, headers:, body:)
|
||||
|
||||
send_data(result.body, filename: 'attestation.pdf', type: 'application/pdf', disposition: 'inline')
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue