richardschneider / yappy

Yet another REST API server howling at the moon with JSON
MIT License
2 stars 0 forks source link

self-test rework #118

Open richardschneider opened 8 years ago

richardschneider commented 8 years ago
// TODO This has to be reworked.  Need a mechanism to determine if the response
    // is a full full resource or contains a list of resources.  The '?only' feature which
    // returns partial resource(s) break this self
    // if (isJson(ctx)) {
    //     let content = ctx.body.data || (Array.isArray(ctx.body) ? ctx.body : [ctx.body]);
    //     for (let resource of content) {
    //         should.exist(resource, 'null content is evil');
    //         should.exist(resource._metadata, 'missing _metadata');
    //         should.exist(resource._metadata.self, 'missing _metadata.self');
    //     }
    //     if (ctx.req.tenant.httpResponse.validateResource)
    //     {
    //         model.validate(ctx.body, null, ctx.res.get('content-type'));
    //     }
    // }