What is the problem?
I just found recently that Twitch had this mock api for testing requests without me needing to be a partner. While testing my integration, I found that I could not change Custom Rewards boolean field is_paused to false. I can set it to true, but not the inverse.
I'm not familiarized with Golang, but tried to investigate the source code and found this code snippet, that may be related:
https://github.com/twitchdev/twitch-cli/blob/main/internal/database/sql_gen.go#L192C8-L194
case bool:
if !f {
continue
}
I may test it later, but from my quick view, this means that falsy f are ignored on update clause, right? Just as zero is ignored on integer clauses
Operating System
Windows WSL
Architecture Version (x86, x64, arm, etc)
x86
Steps to reproduce
- Setup and start mock-api
- Send an update (PATCH) request to
/channel_points/custom_rewards changing the boolean field is_paused
When passing a true value, the request works and update the custom reward is_paused field. However, when we try to set this field as false, it does not happen. Here's a curl request:
curl 'http://localhost:3000/api/mock/channel_points/custom_rewards?broadcaster_id=36028131&id=a2279f06-0856-213d-02ba-99c9d2041cb6' -X 'PATCH' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7' -H 'Authorization: Bearer a87ee147eaa5469' -H 'Client-Id: 9607c0f8e0f2a957877be84be7e21c' -H 'Connection: keep-alive' -H 'Content-Type: application/json' -H 'DNT: 1' -H 'Origin: http://localhost:3000' -H 'Referer: http://localhost:3000/custom-rewards' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36' -H 'sec-ch-ua: "Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"' -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' --data-raw '{"is_paused":false}'
There's no error log, it will just return me the payload containing a custom reward with is_paused: true
Relevant log output
No response
What is the problem?
I just found recently that Twitch had this mock api for testing requests without me needing to be a partner. While testing my integration, I found that I could not change Custom Rewards boolean field
is_pausedtofalse. I can set it totrue, but not the inverse.I'm not familiarized with Golang, but tried to investigate the source code and found this code snippet, that may be related:
https://github.com/twitchdev/twitch-cli/blob/main/internal/database/sql_gen.go#L192C8-L194
I may test it later, but from my quick view, this means that falsy
fare ignored on update clause, right? Just as zero is ignored on integer clausesOperating System
Windows WSL
Architecture Version (x86, x64, arm, etc)
x86
Steps to reproduce
/channel_points/custom_rewardschanging the boolean fieldis_pausedWhen passing a
truevalue, the request works and update the custom rewardis_pausedfield. However, when we try to set this field asfalse, it does not happen. Here's a curl request:There's no error log, it will just return me the payload containing a custom reward with
is_paused: trueRelevant log output
No response