Sha256: 7083b9fdca2d74194dea2586fe9d2bd11b7937739ee2a308d0e5e5f66c84851e
Contents?: true
Size: 452 Bytes
Versions: 8
Compression:
Stored size: 452 Bytes
Contents
require 'json' module Bowser module HTTP class Response def initialize xhr @xhr = xhr end def code `#@xhr.status` end def body `#@xhr.response` end def json body = self.body @json ||= JSON.parse(body) if `body !== undefined` end def success? (200...400).cover? code end def fail? !success? end end end end
Version data entries
8 entries across 8 versions & 1 rubygems