MCPcopy
hub / github.com/ampproject/amphtml / assertHttpsUrl

Function assertHttpsUrl

src/url.js:311–332  ·  view source on GitHub ↗
(
  urlString,
  elementContext,
  sourceName = 'source'
)

Source from the content-addressed store, hash-verified

309 * @return {string}
310 */
311export function assertHttpsUrl(
312 urlString,
313 elementContext,
314 sourceName = 'source'
315) {
316 userAssert(
317 urlString != null,
318 '%s %s must be available',
319 elementContext,
320 sourceName
321 );
322 userAssert(
323 isSecureUrlDeprecated(urlString) || /^\/\//.test(urlString),
324 '%s %s must start with ' +
325 '"https://" or "//" or be relative and served from ' +
326 'either https or from localhost. Invalid value: %s',
327 elementContext,
328 sourceName,
329 urlString
330 );
331 return urlString;
332}
333
334/**
335 * Asserts that a given url is an absolute HTTP or HTTPS URL.

Callers 15

test-url.jsFile · 0.90
batchFetchJsonForFunction · 0.90
onDocumentFormSubmit_Function · 0.90
netletixFunction · 0.90
buildCallbackMethod · 0.90
renderNonAmpCreativeMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
buildConfigLoginMap_Method · 0.90
constructorMethod · 0.90
parseAndValidateMethod · 0.90

Calls 3

userAssertFunction · 0.90
isSecureUrlDeprecatedFunction · 0.85
testMethod · 0.45

Tested by

no test coverage detected