MCPcopy
hub / github.com/axios/axios / handleFormData

Function handleFormData

tests/setup/server.js:145–161  ·  view source on GitHub ↗
(req)

Source from the content-addressed store, hash-verified

143};
144
145export const handleFormData = (req) => {
146 return new Promise((resolve, reject) => {
147 const form = new IncomingForm();
148
149 form.parse(req, (err, fields, files) => {
150 if (err) {
151 // Drain any unread bytes so the kernel doesn't send an RST when the
152 // server closes the response. An unread request buffer is what causes
153 // the client write side to surface EPIPE on a subsequent test.
154 if (typeof req.resume === 'function') req.resume();
155 return reject(err);
156 }
157
158 resolve({ fields, files });
159 });
160 });
161};
162
163export const nodeVersion = process.versions.node.split('.').map((v) => parseInt(v, 10));
164

Callers 2

http.test.jsFile · 0.90
handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected