MCPcopy
hub / github.com/axios/axios / setFormDataHeaders

Function setFormDataHeaders

lib/helpers/resolveConfig.js:13–24  ·  view source on GitHub ↗
(headers, formHeaders, policy)

Source from the content-addressed store, hash-verified

11const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
12
13function setFormDataHeaders(headers, formHeaders, policy) {
14 if (policy !== 'content-only') {
15 headers.set(formHeaders);
16 return;
17 }
18
19 Object.entries(formHeaders || {}).forEach(([key, val]) => {
20 if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
21 headers.set(key, val);
22 }
23 });
24}
25
26/**
27 * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().

Callers 1

resolveConfigFunction · 0.70

Calls 3

setMethod · 0.80
forEachMethod · 0.80
entriesMethod · 0.80

Tested by

no test coverage detected