https://github.com/sequencemedia/verify-url
Verify URLs in Node with Fetch or SuperAgent
https://github.com/sequencemedia/verify-url
Last synced: 3 months ago
JSON representation
Verify URLs in Node with Fetch or SuperAgent
- Host: GitHub
- URL: https://github.com/sequencemedia/verify-url
- Owner: sequencemedia
- Created: 2022-10-05T16:49:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-01-10T03:59:20.000Z (5 months ago)
- Last Synced: 2026-01-11T01:11:20.453Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 2.42 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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`
```typescript
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`
```typescript
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`
```typescript
export interface RequestFailure {
verification: string;
url: string;
error: {code: string};
}
```