How to use the @tinkoff/request-core.HttpMethods.HEAD function in @tinkoff/request-core

To help you get started, we’ve selected a few @tinkoff/request-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TinkoffCreditSystems / tinkoff-request / packages / plugin-protocol-http / src / http.ts View on Github external
url,
                query,
                queryNoCache,
                headers,
                type = 'form',
                payload,
                attaches = [],
                timeout,
                withCredentials,
                abortPromise,
                responseType,
            } = context.getRequest();

            let ended = false;
            const method = httpMethod.toLowerCase();
            const noBody = method === HttpMethods.GET || method === HttpMethods.HEAD;

            let body;
            let formHeaders;

            if (attaches.length) {
                body = createForm(payload, isBrowser ? attaches : []);

                formHeaders = body.getHeaders && body.getHeaders();
            } else {
                const contentType = propOr(type, type, REQUEST_TYPES);
                formHeaders = contentType ? { 'Content-type': contentType } : {};

                if (!noBody) {
                    body = serialize(type, payload);
                }
            }

@tinkoff/request-core

Request library extendable by plugins

Apache-2.0
Latest version published 6 months ago

Package Health Score

45 / 100
Full package analysis