@optimizely/optimizely-sdk
Version:
JavaScript SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts
54 lines (53 loc) • 2.02 kB
TypeScript
/**
* Copyright 2022, 2024 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AbortableRequest, Headers, RequestHandler } from './http';
import { LoggerFacade } from '../../logging/logger';
import { Platform } from '../../platform_support';
/**
* Handles sending requests and receiving responses over HTTP via XMLHttpRequest
*/
export declare class BrowserRequestHandler implements RequestHandler {
private logger?;
private timeout;
constructor(opt?: {
logger?: LoggerFacade;
timeout?: number;
});
/**
* Builds an XMLHttpRequest
* @param requestUrl Fully-qualified URL to which to send the request
* @param headers List of headers to include in the request
* @param method HTTP method to use
* @param data?? stringified version of data to POST, PUT, etc
* @returns AbortableRequest contains both the response Promise and capability to abort()
*/
makeRequest(requestUrl: string, headers: Headers, method: string, data?: string): AbortableRequest;
/**
* Sets the header collection for an XHR
* @param headers Headers to set
* @param request Request into which headers are to be set
* @private
*/
private setHeadersInXhr;
/**
* Parses headers from an XHR
* @param request Request containing headers to be retrieved
* @private
* @returns List of headers without duplicates
*/
private parseHeadersFromXhr;
}
export declare const __platforms: Platform[];