<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to send 204 instead of empty report]]></title><description><![CDATA[<p>Hi,</p>
<p>We have a report, which fetches data from a REST webservice with beforeRender. Sometimes this data is empty - resulting in an empty report (a complete white pdf).</p>
<p>Is it possible to exit report generation in beforeRender (if REST response is empty) and send a 204 status to the calling client?</p>
<p>Here some code:</p>
<pre><code>function beforeRender(req, res, done) {
    require('request')({
        rejectUnauthorized: false, //Fehlerbehebung: UNABLE_TO_VERIFY_LEAF_SIGNATURE
        url: 'https://someurl/api/v2/something',
        json: true,
        encoding: 'utf8',
        method: 'POST',
        headers: {
            'Authorization': 'Basic abc123',
            'X-DreamFactory-Api-Key': 'abc123',
            'Accept': 'application/json'
        },
        body: {
            &quot;params&quot;: [{
                &quot;name&quot;: &quot;loginin&quot;,
                &quot;param_type&quot;: &quot;IN&quot;,
                &quot;value&quot;: req.data.loginin
            }],
            &quot;wrapper&quot;: &quot;data&quot;
        }
    }, function(err, response, body) {
        if (err) {
            return done(err);
        }
        req.data = { items: body };
        done();
    });
}
</code></pre>
<p>Reto E.</p>
]]></description><link>https://forum.jsreport.net/topic/1343/how-to-send-204-instead-of-empty-report</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 11:36:29 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/1343.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Nov 2019 11:10:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to send 204 instead of empty report on Invalid Date]]></title><description><![CDATA[<p>Hi,</p>
<p>We have a report, which fetches data from a REST webservice with beforeRender. Sometimes this data is empty - resulting in an empty report (a complete white pdf).</p>
<p>Is it possible to exit report generation in beforeRender (if REST response is empty) and send a 204 status to the calling client?</p>
<p>Here some code:</p>
<pre><code>function beforeRender(req, res, done) {
    require('request')({
        rejectUnauthorized: false, //Fehlerbehebung: UNABLE_TO_VERIFY_LEAF_SIGNATURE
        url: 'https://someurl/api/v2/something',
        json: true,
        encoding: 'utf8',
        method: 'POST',
        headers: {
            'Authorization': 'Basic abc123',
            'X-DreamFactory-Api-Key': 'abc123',
            'Accept': 'application/json'
        },
        body: {
            &quot;params&quot;: [{
                &quot;name&quot;: &quot;loginin&quot;,
                &quot;param_type&quot;: &quot;IN&quot;,
                &quot;value&quot;: req.data.loginin
            }],
            &quot;wrapper&quot;: &quot;data&quot;
        }
    }, function(err, response, body) {
        if (err) {
            return done(err);
        }
        req.data = { items: body };
        done();
    });
}
</code></pre>
<p>Reto E.</p>
]]></description><link>https://forum.jsreport.net/post/6206</link><guid isPermaLink="true">https://forum.jsreport.net/post/6206</guid><dc:creator><![CDATA[RetoE]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to How to send 204 instead of empty report on Invalid Date]]></title><description><![CDATA[<p>Thank you for your request.<br />
I am afraid it isn't possible to set custom status code from script at this moment.<br />
I've submitted this feature request to the github<br />
<a href="https://github.com/jsreport/jsreport/issues/653" rel="nofollow">https://github.com/jsreport/jsreport/issues/653</a><br />
It is quite a quick win so we likely make sure it is ready in the next release.</p>
]]></description><link>https://forum.jsreport.net/post/6244</link><guid isPermaLink="true">https://forum.jsreport.net/post/6244</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>