UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

54 lines (53 loc) • 1.73 kB
/** * DevExtreme (esm/__internal/data/odata/request_dispatcher.js) * Version: 26.1.6 * Build date: Fri Oct 16 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import "../../../common/data/odata/query_adapter"; import { sendRequest } from "../../../common/data/odata/utils"; const DEFAULT_PROTOCOL_VERSION = 4; export default class RequestDispatcher { constructor(options) { const dispatcherOptions = options || {}; this._url = String(dispatcherOptions.url).replace(/\/+$/, ""); this._beforeSend = dispatcherOptions.beforeSend; this._jsonp = dispatcherOptions.jsonp; this._version = dispatcherOptions.version || 4; this._withCredentials = dispatcherOptions.withCredentials; this._processDatesAsUtc = dispatcherOptions.processDatesAsUtc ?? dispatcherOptions.deserializeDates ?? false; this._filterToLower = dispatcherOptions.filterToLower } sendRequest(url, method, params, payload) { return sendRequest(this.version, { url: url, method: method, params: params ?? {}, payload: payload }, { beforeSend: this._beforeSend, jsonp: this._jsonp, withCredentials: this._withCredentials, processDatesAsUtc: this._processDatesAsUtc }) } get version() { return this._version } get beforeSend() { return this._beforeSend } get url() { return this._url } get jsonp() { return this._jsonp } get filterToLower() { return this._filterToLower } }