Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

使用post请求取消喜欢音乐会失败 #1024

Closed
Clarkkkk opened this issue Nov 10, 2020 · 6 comments
Closed

使用post请求取消喜欢音乐会失败 #1024

Clarkkkk opened this issue Nov 10, 2020 · 6 comments
Labels

Comments

@Clarkkkk
Copy link
Contributor

环境

  • 系统/平台: centOS

  • API版本: 3.41.2

出现问题

post 请求代码:

fetch(requestURL, {
    method: 'post',
    headers: {'Content-Type': 'application/json;charset=utf-8'},
    body: {
        id: id,
        like: false
        // cookie
    }
  })
  // response...

注意到在 like.js 中,query.like = query.like == 'false' ? false : true 会把字符串的 like 转为布尔值,但布尔值的 like 会一律转化为 true(因为==操作符左边的布尔值会先隐式转换为 0 或 1 再进行对比),加一个判断可以解决:

if (typeof query.like !== 'boolean') {
    query.like = query.like === 'false' ? false : true
}

来回报一下

@Binaryify
Copy link
Owner

确实存在这个问题,下次更新会修改下

@Binaryify
Copy link
Owner

已更新~

@passing11
Copy link

已更新~

我现在用get取消喜欢也失败了,添加还是正常的

@Binaryify
Copy link
Owner

@passing11 时间戳加了吗

@passing11
Copy link

@passing11 时间戳加了吗

试过了,也没反应

@passing11
Copy link

@passing11 时间戳加了吗

现在用的是4.5.7版本,是不是没更新的缘故啊

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants