MCPcopy Create free account
hub / github.com/Kong/httpsnippet / addTargetClient

Function addTargetClient

src/targets/targets.ts:195–211  ·  view source on GitHub ↗
(targetId: TargetId, client: Client)

Source from the content-addressed store, hash-verified

193};
194
195export const addTargetClient = (targetId: TargetId, client: Client) => {
196 if (!isClient(client)) {
197 return;
198 }
199
200 if (!Object.prototype.hasOwnProperty.call(targets, targetId)) {
201 throw new Error(`Sorry, but no ${targetId} target exists to add clients to`);
202 }
203
204 if (Object.prototype.hasOwnProperty.call(targets[targetId], client.info.key)) {
205 throw new Error(
206 `the target ${targetId} already has a client with the key ${client.info.key}, please use a different key`,
207 );
208 }
209
210 targets[targetId].clientsById[client.info.key] = client;
211};

Callers 1

targets.test.tsFile · 0.90

Calls 1

isClientFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…