hapijs / crumb

CSRF crumb generation and validation for hapi
Other
171 stars 51 forks source link

Restful example generate endpoint responds with text/html response #64

Closed mtharrison closed 8 years ago

mtharrison commented 9 years ago

Just wondering if there's any good reason that the restful example /generate endpoint responds with text/html and a JSONy looking string:

server.route({
    method: 'GET',
    path: '/generate',
    handler: function (request, reply) {

        // return crumb if desired
        return reply('{ "crumb": ' + request.plugins.crumb + ' }');
    }
});

rather than:

server.route({
    method: 'GET',
    path: '/generate',
    handler: function (request, reply) {

        // return crumb if desired
        return reply({ crumb: request.plugins.crumb });
    }
});

Happy to make a PR if you think it's worth it.

stongo commented 9 years ago

good point. a PR would be appreciated :)

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.