mirror of https://github.com/Kylart/KawAnime.git
Fix attempt to offline leak
This commit is contained in:
parent
93a6c4206b
commit
8d4fe2a18c
|
@ -1,13 +1,11 @@
|
|||
const axios = require('axios')
|
||||
|
||||
const isOnline = async (req, res) => {
|
||||
try {
|
||||
const {status} = await axios.get('https://myanimelist.net')
|
||||
|
||||
res.status(status === 200 ? 200 : 204).send()
|
||||
} catch (e) {
|
||||
res.status(204).send()
|
||||
}
|
||||
const isOnline = (req, res) => {
|
||||
axios.get('https://myanimelist.net')
|
||||
.then(({status}) => {
|
||||
res.status(status === 200 ? 200 : 204).send()
|
||||
})
|
||||
.catch(() => res.status(204).send())
|
||||
}
|
||||
|
||||
module.exports = isOnline
|
||||
|
|
Loading…
Reference in New Issue