function createFormDataPayload(payload, onError) {
    const boundary = createBoundary();
    const itr = payloadToMultipartItr(payload, boundary);
    const safeItr = protectItr(itr, onError);
    const stream = (0, platform_node_js_1.itrToStream)(safeItr);
    return {
        method: "POST",
        headers: {
            "content-type": `multipart/form-data; boundary=${boundary}`,
            connection: "keep-alive",
        },
        body: stream,
    };
}
/**
 * Turns a payload into an options object that can be passed to a `fetch` call
 * by setting the necessary headers and method. Note that this method creates a
 * multipart/form-data stream under the hood. If possible, a JSON payload should
 * be created instead for performance reasons.
 *
 * @param payload The payload to wrap
 */
Turns a payload into an options object that can be passed to a `fetch` call
by setting the necessary headers and method. Note that this method creates a
multipart/form-data stream under the hood. If possible, a JSON payload should
be created instead for performance reasons.

@param payload The payload to wrap
Turns a payload into an options object that can be passed to a ` fetch ` call by setting the necessary headers and method . Note that this method creates a multipart / form - data stream under the hood . If possible a JSON payload should be created instead for performance reasons . @param payload The payload to wrap
function createFormDataPayload(payload, onError) {
    const boundary = createBoundary();
    const itr = payloadToMultipartItr(payload, boundary);
    const safeItr = protectItr(itr, onError);
    const stream = (0, platform_node_js_1.itrToStream)(safeItr);
    return {
        method: "POST",
        headers: {
            "content-type": `multipart/form-data; boundary=${boundary}`,
            connection: "keep-alive",
        },
        body: stream,
    };
}
function createFormDataPayload ( payload , onError ) { const boundary = createBoundary ( ) ; const itr = payloadToMultipartItr ( payload , boundary ) ; const safeItr = protectItr ( itr , onError ) ; const stream = ( 0 , platform_node_js_1 . itrToStream ) ( safeItr ) ; return { method : "POST" , headers : { "content-type" : ` ${ boundary } ` , connection : "keep-alive" , } , body : stream , } ; }
Turns a payload into an options object that can be passed to a `fetch` call
 by setting the necessary headers and method.
Turns a payload into an options object that can be passed to a ` fetch ` call by setting the necessary headers and method .