diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-09-14 21:51:25 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-09-14 21:51:25 +0300 |
commit | 5687ff6c4a1186e08737156e784162376719bd39 (patch) | |
tree | eb4d871eb7a3acb2ce3ccd5272695aa0faa971bf /test/support | |
parent | d52eece03ab744fa7c18bbdf70e20b5bd9589f13 (diff) | |
parent | 39d769f25057dbaf89dc23d39941780bc65c2b06 (diff) | |
download | pleroma-media-preview-proxy.tar.gz |
Merge remote-tracking branch 'remotes/origin/develop' into media-preview-proxymedia-preview-proxy
Diffstat (limited to 'test/support')
-rw-r--r-- | test/support/http_request_mock.ex | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 344e27f13..cb022333f 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -1262,4 +1262,21 @@ defmodule HttpRequestMock do inspect(headers) }"} end + + # Most of the rich media mocks are missing HEAD requests, so we just return 404. + @rich_media_mocks [ + "https://example.com/ogp", + "https://example.com/ogp-missing-data", + "https://example.com/twitter-card" + ] + def head(url, _query, _body, _headers) when url in @rich_media_mocks do + {:ok, %Tesla.Env{status: 404, body: ""}} + end + + def head(url, query, body, headers) do + {:error, + "Mock response not implemented for HEAD #{inspect(url)}, #{query}, #{inspect(body)}, #{ + inspect(headers) + }"} + end end |