INNER CODE UNIT · JavaScript

req

danmindru/responsive-html-email-signature · tasks/check-for-image-url.js:98

  const req = lib.get(url, res => {
    // Check for redirect
    if (res.statusCode >= 301 && res.statusCode < 400 && res.headers.location) {
      // Redirect
      return getHTTPBase64(res.headers.location, callback);
    }
    // Check for HTTP errors
    if (res.statusCode < 200 || res.statusCode >= 400) {
      return callback(new Error('Failed to load page, status code: ' + res.statusCode));
    }
    // Get file format
    let format;
    if (res.headers['content-type']) {
      const matches = res.headers['content-type'].match(MIME_TYPE_REGEX);
      if (matches) {
        format = matches[1];
      }
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…