Skip to content

Commit

Permalink
Merge pull request #157 from veraPDF/feature/support-content-length-p…
Browse files Browse the repository at this point in the history
…roperty

Added filesize to X-File-Size param in header
  • Loading branch information
daryaromanchuk authored Mar 26, 2024
2 parents 0dc4f1f + dd06e14 commit 9ac7350
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/main/resources/assets/js/vera.results.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var pdfaValidator = {
}
})
},
validate: function (formData, flavour, callback, contentType = "json") {
validate: function (formData, flavour, callback, contentType = "json", fileSize) {
$.ajax({
beforeSend(xhrObj) {
let headerpt1 = (contentType === "html") ? "text/" : "application/";
Expand All @@ -43,6 +43,9 @@ var pdfaValidator = {
dataType: contentType,
contentType: false,
processData: false,
headers: {
"X-File-Size": fileSize
},
success: function (data, textStatus, jqXHR) {
pdfaValidator.result = jqXHR.responseText
callback()
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/js/verapdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@ function callVeraPdfService () {
$.when($('#results').empty()).then(addFileConfigurationToResult());
var spinHtml = $('#spinner-template').html()
$('#results').html(spinHtml)
var selectedFile = $('#fileInput')[0].files[0];
pdfaValidator.validate(formData, flavour, function () {
$.when(renderResult()).done(showDownloadBtn());
}, outputFormat)
}, outputFormat, selectedFile.size)
}

function addFileConfigurationToResult () {
Expand Down

0 comments on commit 9ac7350

Please sign in to comment.