Raise better exception on FASP error responses (#35262)
This commit is contained in:
parent
025abf7325
commit
7051458467
2 changed files with 21 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue