mirror of
https://github.com/benjaminion/upgrading-ethereum-book.git
synced 2026-01-09 22:47:55 -05:00
Add HTML validation utility
This commit is contained in:
20
bin/util/validate.js
Normal file
20
bin/util/validate.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const axios = require('axios')
|
||||
const fs=require('fs')
|
||||
|
||||
module.exports.validateHtml = (fileName) => {
|
||||
|
||||
const file = fs.readFileSync(fileName)
|
||||
|
||||
axios({
|
||||
method: 'post',
|
||||
url: 'https://validator.w3.org/nu/?out=json',
|
||||
data: file,
|
||||
headers: {
|
||||
'Content-Type': 'text/html'
|
||||
},
|
||||
maxContentLength: Infinity,
|
||||
maxBodyLength: Infinity
|
||||
}).then(function (response) {
|
||||
console.log(response.data.messages.filter(m => m.type !== 'info'));
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user