<commit_before>const query = require('qs');
const { Unavailable } = require('@feathersjs/errors');
const { _ } = require('@feathersjs/commons');
const { stripSlashes } = require('@feathersjs/commons');
const { convert } = require('@feathersjs/errors');

function toError (error) {
  if (error.code === 'ECONNREFUSED') {
    throw new Unavailable(error.message, _.pick(error, 'address', 'port', 'config'));
  }

  throw convert(error);
}

class Base {
  constructor (settings) {
    this.name = stripSlashes(settings.name);
    this.options = settings.options;
    this.connection = settings.connection;
    this.base = `${settings.base}/${this.name}`;
  }

  makeUrl (params, id) {
    params = params || {};
    let url = this.base;

    if (typeof id !== 'undefined' && id !== null) {
      url += `/${encodeURIComponent(id)}`;
    }

    if (Object.keys(params).length !== 0) {
      const queryString = query.stringify(params);

      url += `?${queryString}`;
    }

    return url;
  }

  find (params = {}) {
    return this.request({
      url: this.makeUrl(params.query),
      method: 'GET',
      headers: Object.assign({}, params.headers)<commit_msg>fix(rest-client): Allow to customize getting the query (#1594)<commit_after>const qs = require('qs');
const { Unavailable } = require('@feathersjs/errors');
const { _ } = require('@feathersjs/commons');
const { stripSlashes } = require('@feathersjs/commons');
const { convert } = require('@feathersjs/errors');

function toError (error) {
  if (error.code === 'ECONNREFUSED') {
    throw new Unavailable(error.message, _.pick(error, 'address', 'port', 'config'));
  }

  throw convert(error);
}

class Base {
  constructor (settings) {
    this.name = stripSlashes(settings.name);
    this.options = settings.options;
    this.connection = settings.connection;
    this.base = `${settings.base}/${this.name}`;
  }

  makeUrl (query, id) {
    query = query || {};
    let url = this.base;

    if (typeof id !== 'undefined' && id !== null) {
      url += `/${encodeURIComponent(id)}`;
    }

    return url + this.getQuery(query);
  }

  getQuery (query) {
    if (Object.keys(query).length !== 0) {
      const queryString = qs.stringify(query);

      return `?${queryString}`;
    }

    return '';
  }

  find (params = {}) {
    return this.request({
      url: this.makeUrl(params.query),
      method: 'GET',
      headers: Object.assign({}, params.headers)
{'fraction_non_alphanumeric': 0.17807089859851608, 'fraction_numerical': 0.00247320692497939, 'mean_word_length': 3.3967391304347827, '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': '6865859', 'n_tokens_mistral': 784, 'n_tokens_neox': 786, 'n_words': 166}