2
0

Raise better exception on FASP error responses (#35262)

This commit is contained in:
David Roetzel
2025-07-04 09:25:42 +02:00
committed by Claire
parent 025abf7325
commit 7051458467
2 changed files with 21 additions and 5 deletions

View File

@@ -49,6 +49,8 @@ class Fasp::Request
end
def validate!(response)
raise Mastodon::UnexpectedResponseError, response if response.code >= 400
content_digest_header = response.headers['content-digest']
raise Mastodon::SignatureVerificationError, 'content-digest missing' if content_digest_header.blank?
raise Mastodon::SignatureVerificationError, 'content-digest does not match' if content_digest_header != content_digest(response.body)