SparkPost/node-sparkpost

Preview draft option bug

avigoldman opened this issue · 0 comments

Looks like we have a bug with the template preview function.

sparkpost.templates.preview('template-id', {
	substitution_data: {},
	draft: false
})

This code will actually preview the draft since the code is falsey checking the draft option.
We need to update it to check if the object has the draft property, instead of if the value is truthy.
Line with the issue: https://github.com/SparkPost/node-sparkpost/blob/master/lib/templates.js#L143

You can work around it by setting draft to "false" (as a string).