/**
 * Wrapper for built-in http.js to emulate the browser XMLHttpRequest object.
 *
 * This can be used with JS designed for browsers to improve reuse of code and
 * allow the use of existing libraries.
 *
 * Usage: import { XMLHttpRequest } from "XMLHttpRequest";
 *
 * Source:
 *  GitHub: https://github.com/mjwwit/node-XMLHttpRequest
 *  NPM: https://www.npmjs.com/package/xmlhttprequest-ssl
 *
 * @author Dan DeFelippi <dan@driverdan.com>
 * @contributor David Ellis <d.f.ellis@ieee.org>
 * @contributor Michael de Wit <mjwwit@gmail.com> (Fork used in this project)
 * @contributor Marcelo Lv Cabral <marcelo@lvcabral.com> (TypeScript conversion and sync fixes)
 * @license MIT
 */
export declare class XMLHttpRequest {
    /**
     * Private variables
     */
    private _opts;
    private _request;
    private _response;
    private _settings;
    private _disableHeaderCheck;
    private _headers;
    private _sendFlag;
    private _errorFlag;
    private _abortedFlag;
    private _listeners;
    /**
     * Constants
     */
    readonly UNSENT = 0;
    readonly OPENED = 1;
    readonly HEADERS_RECEIVED = 2;
    readonly LOADING = 3;
    readonly DONE = 4;
    /**
     * Public vars
     */
    readyState: number;
    responseType: any;
    responseText: string;
    responseXML: string;
    response: Buffer<ArrayBuffer>;
    status: number;
    statusText: string;
    withCredentials: boolean;
    constructor(opts?: any);
    /**
     * Private methods
     */
    /**
     * Check if the specified header is allowed.
     *
     * @param string header Header to validate
     * @return boolean False if not allowed, otherwise true
     */
    private isAllowedHttpHeader;
    /**
     * Check if the specified method is allowed.
     *
     * @param string method Request method to validate
     * @return boolean False if not allowed, otherwise true
     */
    private isAllowedHttpMethod;
    /**
     * Public methods
     */
    /**
     * Open the connection. Currently supports local server requests.
     *
     * @param string method Connection method (eg GET, POST)
     * @param string url URL for the connection.
     * @param boolean async Asynchronous connection. Default is true.
     * @param string user Username for basic authentication (optional)
     * @param string password Password for basic authentication (optional)
     */
    open(method: string, url: string, async?: boolean, user?: string, password?: string): void;
    /**
     * Disables or enables isAllowedHttpHeader() check the request. Enabled by default.
     * This does not conform to the W3C spec.
     *
     * @param boolean state Enable or disable header checking.
     */
    setDisableHeaderCheck(state: boolean): void;
    /**
     * Sets a header for the request.
     *
     * @param string header Header name
     * @param string value Header value
     * @return boolean Header added
     */
    setRequestHeader(header: string, value: string): boolean;
    /**
     * Gets a header from the server response.
     *
     * @param string header Name of header to get.
     * @return string Text of the header or null if it doesn't exist.
     */
    getResponseHeader(header: string): any;
    /**
     * Gets all the response headers.
     *
     * @return string A string with all response headers separated by CR+LF
     */
    getAllResponseHeaders(): string;
    /**
     * Gets a request header
     *
     * @param string name Name of header to get
     * @return string Returns the request header or empty string if not set
     */
    getRequestHeader(name: string): any;
    /**
     * Sends the request to the server.
     *
     * @param string data Optional data to send as request body.
     */
    send(data?: string | Buffer | null): void;
    /**
     * Called when an error is encountered to deal with it.
     * @param  status  {number}    HTTP status code to use rather than the default (0) for XHR errors.
     */
    handleError(error: any, status?: number): void;
    /**
     * Aborts a request.
     */
    abort(): void;
    /**
     * Adds an event listener. Preferred method of binding to events.
     */
    addEventListener(event: string, callback: Function): void;
    /**
     * Remove an event callback that has already been bound.
     * Only works on the matching funciton, cannot be a copy.
     */
    removeEventListener(event: string, callback: Function): void;
    /**
     * Dispatch any events attached using addEventListener.
     */
    dispatchEvent(event: string): void;
    /**
     * Changes readyState and calls onreadystatechange.
     *
     * @param int state New state
     */
    setState(state: number): void;
}
