JSPM

@sequencemedia/verify-url

1.5.159
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q88683F
  • License ISC

Verify URLs in Node with Fetch or SuperAgent

Package Exports

  • @sequencemedia/verify-url
  • @sequencemedia/verify-url/index.mjs

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 (@sequencemedia/verify-url) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@sequencemedia/verify-url

Verifies that a URL is publicly accessible on the network

verifyUrl

The verifyUrl function returns a Promise which resolves to an object

That object is a description

  • It always contains a verification string (either PASS or FAIL)
  • It always contains the url string

1 - The verification request was successful and the remote host returned a status in the success range

The value of verification in the description is PASS

  export interface ResponseSuccess {
    verification: string;
    url: string;
  }

2 - The verification request was successful but the remote host returned a status in the failure range

Dispatching a request was fine but the host or the path was not

  • Perhaps a 500
  • Perhaps a 404
  • Etc

The value of verification in the description is FAIL

  export interface ResponseFailure {
    verification: string;
    url: string;
    response: {status: number};
  }

3 - The verification request failed

Either the url was not a valid URL or dispatching a request to it generated an error

  • Perhaps the host does not exist
  • Perhaps the host is not reachable
  • Etc

The value of verification in the description is FAIL

  export interface RequestFailure {
    verification: string;
    url: string;
    error: {code: string};
  }