Skip to content

Commit

Permalink
fixes checking for 'offline' error code. closes #56
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed May 23, 2024
1 parent 022fcf6 commit d4454e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions colyseus/http.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ function HTTP:request(method, segments, options, callback)
local has_error = (response.status >= 400)
local err = nil

if response.status == 0 then
return callback("offline")
end

-- parse JSON response
if response.headers['content-type'] and string.find(response.headers['content-type'], 'application/json') then
data = json.decode(data)
end

if not data and response.status == 0 then
return callback("offline")
end

if has_error or data.error then
err = {
status = response.status,
Expand Down

0 comments on commit d4454e0

Please sign in to comment.