MCPcopy Create free account
hub / github.com/Kong/httpsnippet / getHeader

Function getHeader

src/helpers/form-data.ts:46–58  ·  view source on GitHub ↗
(boundary: string, name: string, field: { name: string; type: string })

Source from the content-addressed store, hash-verified

44const getFooter = (boundary: string) => `${dashes}${boundary}${dashes}${carriage.repeat(2)}`;
45
46const getHeader = (boundary: string, name: string, field: { name: string; type: string }) => {
47 let header = '';
48
49 header += `${dashes}${boundary}${carriage}`;
50 header += `Content-Disposition: form-data; name="${name}"`;
51
52 if (isBlob(field)) {
53 header += `; filename="${field.name}"${carriage}`;
54 header += `Content-Type: ${field.type || 'application/octet-stream'}`;
55 }
56
57 return `${header}${carriage.repeat(2)}`;
58};
59
60export const formDataIterator = function* (form: FormData, boundary: string) {
61 // @ts-expect-error not sure how this ever worked

Callers 1

form-data.tsFile · 0.70

Calls 1

isBlobFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…