Ajax request and blob content06 September 2016
The web app I am building as a separate nodejs service than run for the sole purpose of generating pdf files for various content. That service does not have access to the database content but receive on each request the data that needs to be printed. And send back the binary data corresponding of the pdf file generated that will be offered to download to the user.
The first version used a GET request but there is a limit with the length of the data that can be passed this way. The limit (between 2kb-5kb) varies from browser and server type and it is recommended not to use this method above 255 bytes.
The switch to a POST request was not that straight forward, I could not understand why the pdf received by the client were always badly formed and unreadable. Turns out that the jquery ajax method does not support the blob format.
This is the bug marked as won't fix
All for the best it made me switch to XMLHttpRequest.