diff --git a/restws.module b/restws.module index e72d483..66eee17 100644 --- a/restws.module +++ b/restws.module @@ -195,7 +195,18 @@ class RestWSException extends Exception { * Sets the router item for the current path when it has a format. */ function restws_init() { - // Do not act on paths that do not contain a period. + _restws_reroute_format_requests(); +} + +/** + * Reroute requests that come from *.{format} paths. + * For example /node/2.json will need a correct page callback to be treated as + * a restws request. + * + * Also, the restws_basic_auth module will need to use this function as well + * to perform this again after logging a user in. + */ +function _restws_reroute_format_requests() { if (strpos(request_path(), '.') === FALSE) { return; } diff --git a/restws_basic_auth/restws_basic_auth.module b/restws_basic_auth/restws_basic_auth.module index 69dc908..fc8de43 100644 --- a/restws_basic_auth/restws_basic_auth.module +++ b/restws_basic_auth/restws_basic_auth.module @@ -33,6 +33,10 @@ function restws_basic_auth_init() { // Always make sure to disable the page cache after we authenticated the // user so that a response never gets into the page cache. drupal_page_is_cacheable(FALSE); + + // Because we need to redetermine the page callback for + // /node/{id}.{format} calls, we call this. + _restws_reroute_format_requests(); } else { // Clear the login form error and remove the login failure message.