UNPKG

ryuu.js

Version:

Ryuu JavaScript Utility Library

40 lines (39 loc) 1.74 kB
/** * Sets the Content-Type header on the provided headers object based on options. * * - If options.contentType is 'multipart', the Content-Type header is not set. * - If options.contentType is provided (and not 'multipart'), it is used as the Content-Type. * - Otherwise, defaults to 'application/json'. * * @param headers - The headers object to modify. * @param options - Optional object that may contain a contentType property. */ export declare function setContentHeaders(headers: Record<string, string>, options?: any): void; /** * Sets or removes the X-DOMO-Ryuu-Session authentication token header. * * @param headers - The headers object to modify. * @param token - The authentication token to set. If falsy, the header is removed. */ export declare function setAuthTokenHeader(headers: Record<string, string>, token: string): string; /** * Sets the responseType property on an XMLHttpRequest if specified in options. * * @param req - The XMLHttpRequest object to modify. * @param options - Optional object that may contain a responseType property. */ export declare function setResponseType(req: XMLHttpRequest, options?: any): void; /** * Handles a DOM node by updating its href or src attribute with a session token if applicable. * * @param node - The DOM node to process. * @param token - The session token to append to URLs. */ export declare function handleNode(node: HTMLElement, token: string): void; /** * Recursively processes all child elements of a node, applying handleNode to each. * * @param node - The parent DOM element whose children will be processed. * @param token - The session token to append to URLs. */ export declare function processBody(node: Element, token: string): void;