MCPcopy Create free account
hub / github.com/ptmt/react-native-macos / convertRequestBody

Function convertRequestBody

Libraries/Network/convertRequestBody.js:26–38  ·  view source on GitHub ↗
(body: RequestBody)

Source from the content-addressed store, hash-verified

24 ;
25
26function convertRequestBody(body: RequestBody): Object {
27 if (typeof body === 'string') {
28 return {string: body};
29 }
30 if (body instanceof FormData) {
31 return {formData: body.getParts()};
32 }
33 if (body instanceof ArrayBuffer || ArrayBuffer.isView(body)) {
34 // $FlowFixMe: no way to assert that 'body' is indeed an ArrayBufferView
35 return {base64: binaryToBase64(body)};
36 }
37 return body;
38}
39
40module.exports = convertRequestBody;

Callers 2

sendRequestMethod · 0.85
sendRequestMethod · 0.85

Calls 2

binaryToBase64Function · 0.85
getPartsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…