<commit_before>import {InvalidResponse} from 'tide/exceptions';
import {encode} from "./querystring";
import {ContentTypes, Credentials} from "./types";
import {debug_logging} from "./logging";

export const DefaultRequestOptions = {
    'content_type': ContentTypes.content_type,
    'method': 'GET',
    'cache': 'default',
    'mode': 'cors',
    'redirect': 'follow',
    'referrer': 'client',
    'referrerPolicy': 'origin-when-cross-origin',
    'credentials': Credentials.same_origin
    // 'integrity' : sub-resource integrity value hash
    // 'body'" request body: blob/buffersource/formdata/urlsearchparams/usvstring
};

export function request(url, options) {
    let o = {...DefaultRequestOptions, ...options};

    let headers = new Headers({
        "Content-Type": options.content_type,
        "Accept"      : options.content_type
    });<commit_msg>Use window location to inform URL<commit_after>import {InvalidResponse} from 'tide/exceptions';
import {encode} from "./querystring";
import {ContentTypes, Credentials} from "./types";
import {debug_logging} from "./logging";

export const DefaultRequestOptions = {
    'content_type': ContentTypes.content_type,
    'method': 'GET',
    'cache': 'default',
    'mode': 'cors',
    'redirect': 'follow',
    'referrer': 'client',
    'referrerPolicy': 'origin-when-cross-origin',
    'credentials': Credentials.same_origin
    // 'integrity' : sub-resource integrity value hash
    // 'body'" request body: blob/buffersource/formdata/urlsearchparams/usvstring
};

export function request(url, options) {
    let o = {...DefaultRequestOptions, ...options};

    let headers = new Headers({
        "Content-Type": options.content_type,
        "Accept"      : options.content_type
    });
    
    if(!url.includes('http')){
        let start = '';
        
        start = window.location.protocol + "//" + window.location.hostname;
        if(window.location.port){
            start = start + ":" + window.location.port;
        }
        
        url = start + url;
    }
{'fraction_non_alphanumeric': 0.1489465948064674, 'fraction_numerical': 0.0, 'mean_word_length': 3.2453222453222454, 'pattern_counts': {'":': 3, '<': 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': '5246285', 'n_tokens_mistral': 598, 'n_tokens_neox': 590, 'n_words': 140}