sbinkert / ZplPrinter

Printer emulator for zpl rendering engine.
34 stars 21 forks source link

Use POST instead of GET #1

Closed pitufo closed 8 years ago

pitufo commented 8 years ago

The Labelary API supports a GET variant and a POST variant. The GET variant embeds the ZPL in the URL. As a result, the ZPL is truncated if it is very long, because URLs are truncated if they are very long:

http://stackoverflow.com/questions/2659952/maximum-length-of-http-get-request

If the ZPL is truncated, it will be missing the final ^XZ command, which prevents the label from printing/rendering and returns the following error in Labelary:

ERROR: requested label 0, but there are only 0 labels

Instead of using the GET variant, the code should use the POST variant to avoid this issue:

https://github.com/sbinkert/ZplPrinter/blob/master/ZplPrinter/js/main.js#L26