class AWS::Core::JsonClient

def extract_error_code response

def extract_error_code response
  if response.http_response.status >= 300 and
      body = response.http_response.body and
      json = (JSON.load(body) rescue nil) and
      type = json["__type"] and
      type =~ /\#(.*)$/
    $1
  end
end

def new_request

def new_request
  req = super
  req.headers["content-type"] = "application/x-amz-json-1.0"
  req
end