fix: delay error

This commit is contained in:
viletyy 2022-06-22 15:58:35 +08:00
parent ac7c2088fd
commit 12be9eb754
4 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
gitea-client (0.5.0) gitea-client (0.6.0)
rest-client (~> 2.1.0) rest-client (~> 2.1.0)
GEM GEM

View File

@ -1,3 +1,4 @@
require "json"
module Gitea module Gitea
module Api module Api
class ServerError < Common::Exception class ServerError < Common::Exception
@ -5,11 +6,11 @@ module Gitea
def initialize(response) def initialize(response)
@http_code = response.code @http_code = response.code
@attrs = JSON.parse(response.body) rescue {}
puts response
end end
def to_s def to_s
@attrs.delete('documentation_url')
@attrs.merge({'HTTPCode' => @http_code}).map do |k, v| @attrs.merge({'HTTPCode' => @http_code}).map do |k, v|
[k, v].join(": ") [k, v].join(": ")
end.join(", ") end.join(", ")

View File

@ -1,4 +1,5 @@
require 'base64' require 'base64'
require 'json'
module Gitea module Gitea
module Api module Api
@ -99,7 +100,7 @@ module Gitea
response.return! response.return!
end end
response JSON.parse(response)
end end
def get_user_agent def get_user_agent

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
module Gitea module Gitea
VERSION = "0.5.0" VERSION = "0.6.0"
end end