Commit 1fe9b872 authored by Jonathan Hunt's avatar Jonathan Hunt

#53 Send Vary header for Places, Routes.

parent 7ca93c0a
......@@ -340,9 +340,15 @@ function climbnz_api_services_resources() {
* Handle content negotiation via place path, e.g.
* /nz/si/aoraki/mt-cook-range/aoraki-mt-cook
*
* Need to ensure that text/html or application/json are cached via Vary: Accept.
*
* Implements hook_node_view().
*/
function climbnz_api_node_view($node, $view_mode, $langcode) {
if (($node->type == 'place' || $node->type =='route') && $view_mode == 'full') {
drupal_add_http_header('Vary', 'Accept', TRUE);
}
if (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== FALSE) {
if ($node->type == 'place' && $view_mode == 'full') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment