<commit_before>'use strict';

/*
 * Simple wrapper for the PHP action API
 */

module.exports = {
    paths: {
        '/v1/{domain}/_svc/action/query': {
            all: {
                request_handler: function(restbase, req) {
                    if (restbase._options.conf.offline) {
                        throw new Error("We are offline, you are tring to fallback to dynamic api");
                    }

                    var rp = req.params;

                    // TODO: this is a hack to allow us to test with a safe/fake
                    // domain, but still call out to a real service
                    var domain = rp.domain;
                    if (domain === 'en.wikipedia.test.local') {
                        domain = 'en.wikipedia.org';
                    }

                    req.uri = 'http://' + domain + '/w/api.php';
                    var body = req.body || req.query;
                    body.action = 'query';
                    // Always request json
                    body.format = 'json';<commit_msg>Typo fix in error message<commit_after>'use strict';

/*
 * Simple wrapper for the PHP action API
 */

module.exports = {
    paths: {
        '/v1/{domain}/_svc/action/query': {
            all: {
                request_handler: function(restbase, req) {
                    if (restbase._options.conf.offline) {
                        throw new Error("We are offline, you are trying to fallback to the dynamic API.");
                    }

                    var rp = req.params;

                    // TODO: this is a hack to allow us to test with a safe/fake
                    // domain, but still call out to a real service
                    var domain = rp.domain;
                    if (domain === 'en.wikipedia.test.local') {
                        domain = 'en.wikipedia.org';
                    }

                    req.uri = 'http://' + domain + '/w/api.php';
                    var body = req.body || req.query;
                    body.action = 'query';
                    // Always request json
                    body.format = 'json';
{'fraction_non_alphanumeric': 0.1054872280037843, 'fraction_numerical': 0.000946073793755913, 'mean_word_length': 1.1213640922768304, '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': '5691374', 'n_tokens_mistral': 548, 'n_tokens_neox': 507, 'n_words': 162}