How can I decode custom HTTP status text(in utf-8) using Axios?


I can’t decode my custom HTTP status text using Axios, it’s Chinese. and I don’t think it’s a server-side problem, because it can be decoded by the browser. so what can I do? Any help is greatly appreciated.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
    axios.get('http://oktool.cc/index/not_found')
        .catch(error => {
            console.log('statusText', error.response.statusText)
        })
</script>
</body>
</html>

Can’t decode by Axios

Decode by the browser

Source: JavaSript – Stack Overflow

November 24, 2021
Category : News
Tags: axios | decode | encoding | http-status | javascript

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.