<commit_before>import ky from 'ky';
import { useStripes } from './StripesContext';

export default () => {
  const { tenant, token, url } = useStripes().okapi;
  return ky.create({
    prefixUrl: url,
    hooks: {
      beforeRequest: [
        request => {
          request.headers.set('X-Okapi-Tenant', tenant);
          request.headers.set('X-Okapi-Token', token);
        }
      ]
    },
    retry: 0
  });
};<commit_msg>useOkapiKy: Pass locale via accept-language header (#1071)<commit_after>import ky from 'ky';
import { useStripes } from './StripesContext';

export default () => {
  const { locale = 'en', tenant, token, url } = useStripes().okapi;
  return ky.create({
    prefixUrl: url,
    hooks: {
      beforeRequest: [
        request => {
          request.headers.set('Accept-Language', locale);
          request.headers.set('X-Okapi-Tenant', tenant);
          request.headers.set('X-Okapi-Token', token);
        }
      ]
    },
    retry: 0
  });
};
{'fraction_non_alphanumeric': 0.1601642710472279, 'fraction_numerical': 0.006160164271047228, 'mean_word_length': 2.482142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2530602', 'n_tokens_mistral': 323, 'n_tokens_neox': 315, 'n_words': 66}