Use HTTParty for fastly_purge (#18731)

This commit is contained in:
Mac Siri 2022-11-15 14:06:55 -05:00 committed by GitHub
parent 422ad2a95a
commit ce05271870
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,10 +9,8 @@ module EdgeCache
end
def self.fastly_purge(api_key, path)
fastly = ::Fastly.new(api_key: api_key)
urls(path).map do |url|
fastly.purge(url)
HTTParty.post("https://api.fastly.com/purge/#{url}", headers: { "Fastly-Key" => api_key })
end
end
private_class_method :fastly_purge
@ -23,7 +21,7 @@ module EdgeCache
URL.url("#{path}?i=i"),
]
end
private_class_method :fastly_purge
private_class_method :urls
end
end
end