What does got.extend do and is there an equivalent function by undici?
I have tried reading the npm documentation in gitHub but am unsure on what got.extend does?
I have the following code, which I would like to write using undici
function initializeClient(clientName) {
log.info('Begin Initializing REST for %s', clientName);
const config = rest[clientName]; // eslint-disable-line security/detect-object-injection
// @ts-ignore
const client = got.extend(config.base);
clients[clientName] = client; // eslint-disable-line security/detect-object-injection
log.info('REST Initialization Complete for %s : %j', clientName, Object.keys(client));
return client;
}
module.exports.initializeClient = initializeClient;
I have tried undici.fetch but that gives
TypeError: Failed to parse URL from [object Object]
is equivalent to:
So if you need to use the same options for each request you make, you can create an instance that has those options set as defaults (so you don't have to pass them each time).
It doesn't look like
undicihas something similar.