mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-24 19:37:26 +00:00
Raise better exception on FASP error responses (#35262)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user