项目作者: trunkcode

项目描述 :
Check HTTP Status and create a list for all the HTTP status code.
高级语言: JavaScript
项目地址: git://github.com/trunkcode/check-http-status.git
创建时间: 2021-04-22T05:02:05Z
项目社区:https://github.com/trunkcode/check-http-status

开源协议:MIT License

下载


check-http-status

NPM version
Downloads
Build 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

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

Via Yarn

  1. yarn add check-http-status --dev

Examples

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

  1. const checkHttpStatus = require('check-http-status');
  2. checkHttpStatus({
  3. 'sitemaps': [
  4. 'https://www.trunkcode.com/page-sitemap.xml',
  5. 'https://www.trunkcode.com/post-sitemap.xml'
  6. ],
  7. 'skip200': true, // Do not report the URLs having HTTP code 200.
  8. 'export': {
  9. 'format': 'xlsx',
  10. 'location': '/Users/trunkcode/Desktop/',
  11. },
  12. 'options': {
  13. 'auth': {
  14. 'password': 'Testing1234',
  15. 'username': 'trunkcode'
  16. },
  17. 'headers': {
  18. 'Accept': 'text/html',
  19. }
  20. }
  21. });

Status Code of the particular URL(s)

  1. const checkHttpStatus = require('check-http-status');
  2. checkHttpStatus({
  3. 'urls': [
  4. 'http://trunkcode.com/',
  5. 'https://example.com/',
  6. 'https://example1234.com/',
  7. 'https://www.trunkcode.com/',
  8. 'https://www.trunkcode.com/test/'
  9. ],
  10. 'skip200': true, // Do not report the URLs having HTTP code 200.
  11. 'export': {
  12. 'format': 'xlsx',
  13. 'location': '/Users/trunkcode/Desktop/',
  14. },
  15. 'options': {
  16. 'auth': {
  17. 'password': 'Testing1234',
  18. 'username': 'trunkcode'
  19. },
  20. 'headers': {
  21. 'Accept': 'text/html',
  22. }
  23. }
  24. });

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

  1. const checkHttpStatus = require('check-http-status');
  2. checkHttpStatus({
  3. 'sitemaps': [
  4. 'https://www.trunkcode.com/page-sitemap.xml',
  5. 'https://www.trunkcode.com/post-sitemap.xml'
  6. ],
  7. 'urls': [
  8. 'http://trunkcode.com/',
  9. 'https://example.com/',
  10. 'https://example1234.com/',
  11. 'https://www.trunkcode.com/',
  12. 'https://www.trunkcode.com/test/'
  13. ],
  14. 'skip200': true, // Do not report the URLs having HTTP code 200.
  15. 'export': {
  16. 'format': 'xlsx',
  17. 'location': '/Users/trunkcode/Desktop/',
  18. },
  19. 'options': {
  20. 'auth': {
  21. 'password': 'Testing1234',
  22. 'username': 'trunkcode'
  23. },
  24. 'headers': {
  25. 'Accept': 'text/html',
  26. }
  27. }
  28. });

Parameters

Attributes Type Required Default Description
sitemaps Array Yes Sitemap(s) URL(s) where the Actual site URL(s) needs to be fetched for checking the HTTP Status.
urls Array Yes URL(s) for which HTTP Status needs to be checked.
skip200 Boolean No false Whether to list the HTTP status 200 URL(s) or not.
export Object No {} Whether to export the status report or not. By default it logs the report on the screen.
options Object No {} 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.