4 ms·
I'm fairly entrenched with Tastypie at the moment, but I've always been jealous of REST Framework's "document at the endpoint" setup. Can I ask how you're dete
by bmelton 14y ago
I'm fairly entrenched with Tastypie at the moment, but I've always been jealous of REST Framework's "document at the endpoint" setup.
Can I ask how you're determining whether or not the client is making an API call vs visiting the page directly? It'd be great to be able to supply Document templates that surface like REST Framework does, but I can't make out whether you're checking the client, the action, the protocol or something altogether different.
- tomchristie 14y agoIt uses the client's 'Accept:' header which specifies which media types it prefers for the response (eg. 'text/html', 'application/json') Browsers will indicate that they prefer HTML, so that's what REST framework serves them.
- bmelton 14y agoSo obvious, I'm embarrassed I didn't think of it first. Much thanks!