1# Posts from the web are capped: 20 a minute for each user (then 429, with2# Retry-After), and a body no larger than a comment may be, escaped. The3# comment itself is held to forge comment's 32 KiB.4. "$(dirname "$0")/../lib.sh"5user dami6user ana7user cat8repo dami/greet9clone dami dami/greet "$T/w/dami"10at "$T/w/dami" commit "first"11ok push_as dami "$T/w/dami" origin main12at "$T/w/dami" git switch -q -c dami/feature13at "$T/w/dami" commit "feature"14ok push_as dami "$T/w/dami" origin dami/feature15private_server16ana=$(ssh_as ana token 2>/dev/null)17cat=$(ssh_as cat token 2>/dev/null)18approve() { http -s -o "$T/res" -D "$T/h" -w '%{http_code}' -H "Authorization: Bearer $1" -X POST "$PRIV/dami/greet/reviews/1/approve"; }1920n=021while [ "$n" -lt 20 ]; do22 eq "$(approve "$ana")" 20023 n=$((n + 1))24done25eq "$(approve "$ana")" 42926has "$T/h" '^Retry-After: 60'27has "$T/res" '"error":"That is a lot at once: wait a minute"'28eq "$(approve "$cat")" 2002930# The body from a file: Linux takes no argument longer than 128 KiB.31code() {32 node -e 'process.stdout.write("body=" + "a".repeat(Number(process.argv[1])))' "$1" >"$T/body"33 http -s -o "$T/res" -w '%{http_code}' -H "Authorization: Bearer $cat" -d "@$T/body" "$PRIV/dami/greet/reviews/1/comment"34}35eq "$(code 32768)" 40036has "$T/res" '"error":"comment: longer than 32 KiB"'37eq "$(code 200000)" 41338eq "$(code 32767)" 200