UNPKG

geostyler

Version:
36 lines (35 loc) 1.4 kB
export type PostOptions = { url: string; params: any; additionalHeaders?: any; additionalFetchOptions?: any; sameOriginCredentials?: boolean; asForm?: boolean; }; /** * A Helper class which simplifies some complex request setups as like fetch * with POST and Content-Type 'application/x-www-form-urlencoded'. * * @class HTTPUtil */ declare class HTTPUtil { /** * A method that performs a fetch request with some predefined configs. * * @param {Object} Options The options object to configure the post request. * It can contain these keys: * {String} url The url we want to send the post to. * {Object} params The post params we want to send. * Default is {}. * {Object} additionalHeaders An object with additional headers as kvp. * Default is {}. * {Object} additionalFetchOptions An object containing additional options * for the fetch API. Compare https://mdn.io/fetch Default is {}. * {Boolean} sameOriginCredentials A flag to control whether the credentials * option to 'same-origin' will be set or left undefined. Default is true. * {Boolean} asForm A flag to set the Content-Type header to * 'application/x-www-form-urlencoded'. Default is true. */ static post(optionsObject: PostOptions): Promise<Response>; } export default HTTPUtil;