【问题标题】:axios returning specials unicode block as data in getStaticProps in next.jsaxios 返回 specials unicode 块作为 next.js 中 getStaticProps 中的数据
【发布时间】:2022-12-04 17:02:39
【问题描述】:

here is the code and the data result

我尝试使用 fetch 方法工作,但使用 'axios' 它没有

【问题讨论】:

标签: javascript node.js typescript function next.js


【解决方案1】:

来自我的other answer


您收到 Brotli (br) 编码。只需将 Accept-Encoding 标头传递给 deflate,服务器就会返回一个 json 输出。

await axios.get('https://jsonplaceholder.typicode.com/todos/1', {
    headers: {
        'Accept-Encoding': 'deflate'
    }
})

【讨论】:

    猜你喜欢
    • 2021-10-17
    • 2021-12-22
    • 2021-03-14
    • 2021-03-16
    • 2021-12-30
    • 2021-02-25
    • 1970-01-01
    • 1970-01-01
    • 2020-10-29
    相关资源
    最近更新 更多