function encodePayload(headers, payload) {
	const type = headers['Content-Type'];

	if (payload instanceof FormData || typeof payload === 'string') {
		return payload;
	} else if (type && type.includes('json')) {
		return JSON.stringify(payload);
	}
	return payload;
}
/**
 * encodePayload - encore the payload if necessary
 *
 * @param  {object} headers request headers
 * @param  {object} payload payload to send with the request
 * @return {string|FormData} The encoded payload.
 */
encore the payload if necessary
@param  {object} headers request headers
@param  {object} payload payload to send with the request
@return {string|FormData} The encoded payload.
encore the payload if necessary @param { object } headers request headers @param { object } payload payload to send with the request @return { string|FormData } The encoded payload .
function encodePayload(headers, payload) {
	const type = headers['Content-Type'];
	if (payload instanceof FormData || typeof payload === 'string') {
		return payload;
	} else if (type && type.includes('json')) {
		return JSON.stringify(payload);
	}
	return payload;
}
function encodePayload ( headers , payload ) { const type = headers [ 'Content-Type' ] ; if ( payload instanceof FormData || typeof payload === 'string' ) { return payload ; } else if ( type && type . includes ( 'json' ) ) { return JSON . stringify ( payload ) ; } return payload ; }
encodePayload - encore the payload if necessary
 @param  {object} headers request headers
 @param  {object} payload payload to send with the request
 @return {string|FormData} The encoded payload.
encodePayload - encore the payload if necessary @param { object } headers request headers @param { object } payload payload to send with the request @return { string|FormData } The encoded payload .