<commit_before>(function (angular) {
    'use strict';

    angular.module('tubular.services')
        .factory('tubularAuthInterceptor', ['$q', '$injector', function ($q, $injector) {
            var authRequestRunning = null;
            return {

                request: function (config) {
                    // Get the service here because otherwise, a circular dependency injection will be detected
                    var tubularHttp = $injector.get("tubularHttp");
                    var apiBaseUrl = tubularHttp.apiBaseUrl;

                    config.headers = config.headers || {};

                    if (
                        config.url.substring(0, apiBaseUrl.length) === apiBaseUrl &&
                        tubularHttp.tokenUrl !== config.url &&
                        tubularHttp.useRefreshTokens &&
                        tubularHttp.requireAuthentication &&
                        tubularHttp.userData.refreshToken) {

                        if (tubularHttp.isBearerTokenExpired()) {
                            // Let's force an error to automatically go directly to the refresh token stuff
                            return $q.reject({ error: 'expired token', status: 401, config: config });
                        }
                    }

                    return config;
                },<commit_msg>Test ngdoc update<commit_after>(function (angular) {
    'use strict';
    /**
     * @ngdoc function
     * @name tubularAuthInterceptor
     * @description
     *
     * Implement a httpInterceptor to handle authorization using bearer tokens
     *
     * @constructor
     * @returns {Object} A httpInterceptor
     * 
     */   
    angular.module('tubular.services')
        .factory('tubularAuthInterceptor', ['$q', '$injector', function ($q, $injector) {
            var authRequestRunning = null;
            return {

                request: function (config) {
                    // Get the service here because otherwise, a circular dependency injection will be detected
                    var tubularHttp = $injector.get("tubularHttp");
                    var apiBaseUrl = tubularHttp.apiBaseUrl;

                    config.headers = config.headers || {};

                    if (
                        config.url.substring(0, apiBaseUrl.length) === apiBaseUrl &&
                        tubularHttp.tokenUrl !== config.url &&
                        tubularHttp.useRefreshTokens &&
                        tubularHttp.requireAuthentication &&
                        tubularHttp.userData.refreshToken) {

                        if (tubularHttp.isBearerTokenExpired()) {
                            // Let's force an error to automatically go directly to the refresh token stuff
                            return $q.reject({ error: 'expired token', status: 401, config: config });
                        }
                    }

                    return config;
                },
{'fraction_non_alphanumeric': 0.0899830220713073, 'fraction_numerical': 0.0027164685908319186, 'mean_word_length': 1.4226973684210527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3228785', 'n_tokens_mistral': 701, 'n_tokens_neox': 635, 'n_words': 169}