export default function request(path, optionOverrides = {}) {
    const options = Object.assign({ headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json'
        } }, optionOverrides);
    if (typeof options.body === `object`)
        options.body = JSON.stringify(options.body);
    return fetch(path, options)
        .then(response => {
        if (!response.ok) {
            return response.json().then(errorContent => {
                const error = new Error(response.statusText);
                Object.assign(error, { response, errorContent });
                throw error;
            });
        }
        if (response.status === 204)
            return response; // No body
        return response.json();
    });
}
//# sourceMappingURL=request.js.map