html-test
Version:
Node.js library for testing HTML files on the fly and output errors in the console with Gulp.js compatibilities
25 lines (22 loc) • 424 B
JavaScript
import axios from 'axios'
/**
* POST HTML for validation to API
*
* @param {string} body
* @returns
*/
const post = async (body) => {
try {
const response = await axios.post('https://validator.nu/', body, {
headers: {
'Content-Type': 'text/html; charset=utf-8',
},
params: {
'out': 'json'
}
})
return response.data.messages
}
catch (err) {}
}
export { post }