MCPcopy Index your code
hub / github.com/parse-community/parse-server / makeCallback

Function makeCallback

src/request.js:64–83  ·  view source on GitHub ↗
(resolve, reject)

Source from the content-addressed store, hash-verified

62};
63
64function makeCallback(resolve, reject) {
65 return function (response) {
66 const chunks = [];
67 response.on('data', chunk => {
68 chunks.push(chunk);
69 });
70 response.on('end', () => {
71 const body = Buffer.concat(chunks);
72 const httpResponse = new HTTPResponse(response, body);
73
74 // Consider <200 && >= 400 as errors
75 if (httpResponse.status < 200 || httpResponse.status >= 400) {
76 return reject(httpResponse);
77 } else {
78 return resolve(httpResponse);
79 }
80 });
81 response.on('error', reject);
82 };
83}
84
85const encodeBody = function ({ body, headers = {} }) {
86 if (typeof body !== 'object') {

Callers 1

httpRequestFunction · 0.70

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected