FIX deal with gitea api response body bug
This commit is contained in:
parent
0f338ede7d
commit
e7662b66ce
|
@ -178,8 +178,10 @@ class Gitea::ClientService < ApplicationService
|
||||||
def get_body_by_status(status, body)
|
def get_body_by_status(status, body)
|
||||||
body, message =
|
body, message =
|
||||||
case status
|
case status
|
||||||
|
when 401 then [nil, "401"]
|
||||||
when 404 then [nil, "404"]
|
when 404 then [nil, "404"]
|
||||||
when 403 then [nil, "403"]
|
when 403 then [nil, "403"]
|
||||||
|
when 500 then [nil, "500"]
|
||||||
else
|
else
|
||||||
if body.present?
|
if body.present?
|
||||||
body = JSON.parse(body)
|
body = JSON.parse(body)
|
||||||
|
@ -198,7 +200,7 @@ class Gitea::ClientService < ApplicationService
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix_body(body)
|
def fix_body(body)
|
||||||
return [body, nil] if body.is_a? Array
|
return [body, nil] if body.is_a?(Array) || body.is_a?(Hash)
|
||||||
|
|
||||||
body['message'].blank? ? [body, nil] : [nil, body['message']]
|
body['message'].blank? ? [body, nil] : [nil, body['message']]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue