Skip to content

Repository files navigation

check-http-status

NPM versionDownloadsBuild Status

Easily check status codes, response headers, and redirect chains in Node.js similar as done from the httpstatus website.

When the site is on VPN so this is where it plays an important role. You can simply connect your system/machine with VPN and run this package locally so it can check the status of your VPN connected URL(s).

It can also check the website that are secured with HTTP Authentication.

Install

Via npm

npm install check-http-status --save-dev

Via Yarn

yarn add check-http-status --dev

Examples

Status Code of the Sitemap(s) URL(s)

constcheckHttpStatus=require('check-http-status');checkHttpStatus({'sitemaps': ['https://www.trunkcode.com/page-sitemap.xml','https://www.trunkcode.com/post-sitemap.xml'],'skip200': true,// Do not report the URLs having HTTP code 200.'export': {'format': 'xlsx','location': '/Users/trunkcode/Desktop/',},'options': {'auth': {'password': 'Testing1234','username': 'trunkcode'},'headers': {'Accept': 'text/html',}}});

Status Code of the particular URL(s)

constcheckHttpStatus=require('check-http-status');checkHttpStatus({'urls': ['http://trunkcode.com/','https://example.com/','https://example1234.com/','https://www.trunkcode.com/','https://www.trunkcode.com/test/'],'skip200': true,// Do not report the URLs having HTTP code 200.'export': {'format': 'xlsx','location': '/Users/trunkcode/Desktop/',},'options': {'auth': {'password': 'Testing1234','username': 'trunkcode'},'headers': {'Accept': 'text/html',}}});

Status Code of the Sitemap(s) URL(s) with particular URL(s)

constcheckHttpStatus=require('check-http-status');checkHttpStatus({'sitemaps': ['https://www.trunkcode.com/page-sitemap.xml','https://www.trunkcode.com/post-sitemap.xml'],'urls': ['http://trunkcode.com/','https://example.com/','https://example1234.com/','https://www.trunkcode.com/','https://www.trunkcode.com/test/'],'skip200': true,// Do not report the URLs having HTTP code 200.'export': {'format': 'xlsx','location': '/Users/trunkcode/Desktop/',},'options': {'auth': {'password': 'Testing1234','username': 'trunkcode'},'headers': {'Accept': 'text/html',}}});

Parameters

AttributesTypeRequiredDefaultDescription
sitemapsArrayYesSitemap(s) URL(s) where the Actual site URL(s) needs to be fetched for checking the HTTP Status.
urlsArrayYesURL(s) for which HTTP Status needs to be checked.
skip200BooleanNofalseWhether to list the HTTP status 200 URL(s) or not.
exportObjectNo{}Whether to export the status report or not. By default it logs the report on the screen.
optionsObjectNo{}Define options like HTTP Auth credentials if the site is locked or headers etc.

NOTE:sitemaps or urls is required. You can define both parameters as well to fetch URL(s) from sitemap and the URL(s) that are not listed in the ssitemap, you can provide them separately.

About

Check HTTP Status and create a list for all the HTTP status code.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages