MCPcopy Create free account
hub / github.com/itwanger/toBeBetterJavaer / normalizeEndpoint

Function normalizeEndpoint

scripts/convert-mdnice-images-to-cdn.js:456–465  ·  view source on GitHub ↗
(endpoint)

Source from the content-addressed store, hash-verified

454}
455
456function normalizeEndpoint(endpoint) {
457 const value = endpoint.startsWith("http://") || endpoint.startsWith("https://")
458 ? endpoint
459 : `https://${endpoint}`;
460 const parsed = new URL(value);
461 return {
462 protocol: parsed.protocol,
463 hostname: parsed.hostname,
464 };
465}
466
467function ossAuthorization(options) {
468 const canonicalizedResource = `/${options.bucket}/${options.objectKey}`;

Callers 1

putOssObjectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected