JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 338043
  • Score
    100M100P100Q182569F
  • License MIT

GET HTTP contents

Package Exports

  • nodemailer-fetch

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nodemailer-fetch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nodemailer-fetch

Fetches HTTP URL contents for nodemailer.

Build Status NPM version

Usage

var fetch = require('nodemailer-fetch');
fetch('http://www.google.com/').pipe(process.stdout);

The method takes the destination URL as the first and optional options object as the second argument. Only GET is supported.

The defaults are the following:

  • Basic auth is supported
  • Up to 5 redirects are followed (Basic auth gets lost after first redirect)
  • gzip is handled if present
  • Cookies are supported
  • No shared HTTP Agent
  • Invalid SSL certs are allowed

options

Possible options are the following:

  • userAgent a string defining the User Agent of the request (by default not set)
  • cookie a cookie string or an array of cookie strings where a cookie is the value used by 'Set-Cookie' header
  • maxRedirects how many redirects to allow (defaults to 5, set to 0 to disable redirects entirely)
var fetch = require('nodemailer-fetch');
fetch('http://www.google.com/', {
    cookie: [
        'cookie_name1=cookie_value1',
        'cookie_name2=cookie_value2; expires=Sun, 16 Jul 3567 06:23:41 GMT',
    ],
    userAgent: 'MyFetcher/1.0'
}).pipe(process.stdout);

Cookies are domain specific like normal browser cookies, so if a redirect happens to another domain, then cookies are not passed to it, HTTPS-only cookies are not passed to HTTP etc.

License

MIT