File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,48 @@ const (
3030 FailAssertResponseHeaderValue
3131)
3232
33+ const DEFAULT_SPEC_FILE = "urls.json"
34+ const MANUAL = `Usage: validate-http-headers SPECFILES...
35+ Iterates through SPECFILES, making requests and validating responses headers
36+
37+ Multiple JSON specs can be passed
38+
39+ $ ./validate-http-headers internal.json external.json mtv.json
40+
41+ Non-zero exit codes indicate failure. All failures begin with "FAIL: "; exit
42+ code constants can be found in validator.go.
43+
44+ Simple spec:
45+
46+ {
47+ "default": {
48+ "requestHeaders": {
49+ "Referer": ["https://bad-website.com"]
50+ },
51+ "responseHeaders": {
52+ "X-Frame-Options": ["SAMEORIGIN"]
53+ }
54+ },
55+
56+ "specs": [
57+ {
58+ "url": "https://www.google.com/"
59+ },
60+ {
61+ "url": "https://drive.google.com/"
62+ }
63+ ]
64+ }
65+
66+ Full documentation at: <https://github.com/talee/validate-http-headers>`
67+
3368func main () {
3469 var filenames []string
3570 if len (os .Args ) == 1 {
71+ if _ , err := os .Stat (DEFAULT_SPEC_FILE ); os .IsNotExist (err ) {
72+ fmt .Println (MANUAL )
73+ os .Exit (0 )
74+ }
3675 filenames = []string {"urls.json" }
3776 } else {
3877 filenames = os .Args [1 :]
You can’t perform that action at this time.
0 commit comments