MCPcopy Create free account
hub / github.com/denoland/std / resolveDerivedComponent

Function resolveDerivedComponent

http/unstable_message_signatures.ts:413–434  ·  view source on GitHub ↗
(
  name: string,
  message: Request | Response,
  params: ComponentParameters,
  parsedUrl: { value?: URL },
)

Source from the content-addressed store, hash-verified

411]);
412
413function resolveDerivedComponent(
414 name: string,
415 message: Request | Response,
416 params: ComponentParameters,
417 parsedUrl: { value?: URL },
418): string {
419 if (REQUEST_ONLY_DERIVED.has(name)) {
420 if (!(message instanceof Request)) {
421 throw new TypeError(`Cannot use "${name}" on a response message`);
422 }
423 return resolveRequestDerived(name, message, params, parsedUrl);
424 }
425
426 if (name === "@status") {
427 if (message instanceof Request) {
428 throw new TypeError(`Cannot use "${name}" on a request message`);
429 }
430 return String(message.status);
431 }
432
433 throw new TypeError(`Unknown derived component "${name}"`);
434}
435
436function resolveRequestDerived(
437 name: string,

Callers 1

resolveComponentValueFunction · 0.85

Calls 2

resolveRequestDerivedFunction · 0.85
hasMethod · 0.65

Tested by

no test coverage detected