<commit_before>// Request utils,
// Feel free to replace with your code
// (get, post are used in ApiServices)

import {getLocalToken, resetLocalToken} from 'api/LocalStorageCookiesSvc'

function requestWrapper (method) {
	return async function (url, data = null, params = {}) {
		if (method === 'GET') {
			// It's a GET response
			// GET doesn't have data
			params = data
			data = null
		} else if (data === Object(data)) {
			// (data === Object(data)) === _.isObject(data)
			data = JSON.stringify(data)
		} else {
			throw new Error(`XHR invalid, check ${method} on ${url}`)
		}

		// Default params for fetch = method + (Content-Type)
		const defaults = {
			method,
			headers: {<commit_msg>fix(src/common/api/utils/xhr_wrapper.js): fix import<commit_after>// Request utils,
// Feel free to replace with your code
// (get, post are used in ApiServices)

import {getLocalToken, resetLocalToken} from 'api/LocalStorageCookiesSvc'

export default function requestWrapper (method) {
	return async function (url, data = null, params = {}) {
		if (method === 'GET') {
			// It's a GET response
			// GET doesn't have data
			params = data
			data = null
		} else if (data === Object(data)) {
			// (data === Object(data)) === _.isObject(data)
			data = JSON.stringify(data)
		} else {
			throw new Error(`XHR invalid, check ${method} on ${url}`)
		}

		// Default params for fetch = method + (Content-Type)
		const defaults = {
			method,
			headers: {
{'fraction_non_alphanumeric': 0.14423076923076922, 'fraction_numerical': 0.0, 'mean_word_length': 3.3363095238095237, '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': '5268525', 'n_tokens_mistral': 505, 'n_tokens_neox': 454, 'n_words': 152}