From ec44df63c7fdba18201992e83574fdce1e3bdc8f Mon Sep 17 00:00:00 2001 From: Shulhan Date: Wed, 4 Jun 2025 01:07:51 +0700 Subject: all: use snake case for JSON fields in Broken result --- README | 26 +++++++++++++------------- brokenlinks.go | 16 ++++++++-------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/README b/README index 2d8b273..3335049 100644 --- a/README +++ b/README @@ -47,9 +47,9 @@ Available commands, { "$PAGE": [{ - "Link": , - "Error": , - "Code": + "link": , + "error": , + "code": }, ... ], @@ -67,24 +67,24 @@ Available commands, { "https://kilabit.info/some/page": [ { - "Link": "https://kilabit.info/some/page/image.png", - "Code": 404 + "link": "https://kilabit.info/some/page/image.png", + "code": 404 }, { - "Link": "https://external.com/link", - "Error": "Internal server error", - "Code": 500 + "link": "https://external.com/link", + "error": "Internal server error", + "code": 500 } ], "https://kilabit.info/another/page": [ { - "Link": "https://kilabit.info/another/page/image.png", - "Code": 404 + "link": "https://kilabit.info/another/page/image.png", + "code": 404 }, { - "Link": "https://external.org/link", - "Error": "Internal server error", - "Code": 500 + "link": "https://external.org/link", + "error": "Internal server error", + "code": 500 } ] } diff --git a/brokenlinks.go b/brokenlinks.go index 768216d..69a14ad 100644 --- a/brokenlinks.go +++ b/brokenlinks.go @@ -15,20 +15,20 @@ const Version = `0.1.0` // reachable during GET or HEAD, either timeout or IP or domain not exist. const StatusBadLink = 700 +// Broken store the broken link, HTTP status code, and the error message that +// cause it. +type Broken struct { + Link string `json:"link"` + Error string `json:"error,omitempty"` + Code int `json:"code"` +} + // BrokenlinksOptions define the options for scanning broken links. type BrokenlinksOptions struct { Url string IsVerbose bool } -// Broken store the broken link, HTTP status code, and the error message that -// cause it. -type Broken struct { - Link string - Error string `json:"omitempty"` - Code int -} - // BrokenlinksResult store the result of scanning for broken links. type BrokenlinksResult struct { // PageLinks store the page and its broken links. -- cgit v1.3