Allow following redirects when passing a URL
Docker / build (push) Waiting to run
Details
Docker / build (push) Waiting to run
Details
This commit is contained in:
parent
eff7cbeffe
commit
96021984e6
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"crystal-lang.mainFile": "${workspaceRoot}/src/main.cr"
|
||||
}
|
|
@ -10,6 +10,9 @@ targets:
|
|||
cli:
|
||||
main: src/console.cr
|
||||
|
||||
crystalline:
|
||||
main: src/main.cr
|
||||
|
||||
dependencies:
|
||||
athena:
|
||||
github: athena-framework/framework
|
||||
|
|
|
@ -38,7 +38,6 @@ module Paste69
|
|||
raise ATH::Exceptions::BadRequest.new("Missing token")
|
||||
end
|
||||
|
||||
|
||||
if fd.has_key?("delete")
|
||||
paste.delete
|
||||
return ATH::Response.new("", status: 200)
|
||||
|
|
|
@ -88,6 +88,12 @@ module Paste69
|
|||
|
||||
headers = HTTP::Headers{ "Accept-Encoding" => "identity" }
|
||||
res = HTTP::Client.get(url, headers: headers)
|
||||
attempts = 1
|
||||
|
||||
while (location = res.headers["Location"]?) && attempts <= 3
|
||||
res = HTTP::Client.get(location, headers: headers)
|
||||
attempts += 1
|
||||
end
|
||||
|
||||
if res.status.to_i >= 300
|
||||
raise ATH::Exceptions::BadRequest.new("URL response was not OK")
|
||||
|
|
Loading…
Reference in New Issue