You are here

private function Client::handleResponse in Smart IP 6.2

Same name and namespace in other branches
  1. 7.2 includes/vendor/maxmind/web-service-common/src/WebService/Client.php \MaxMind\WebService\Client::handleResponse()

Parameters

integer $statusCode the HTTP status code of the response:

string $contentType the Content-Type of the response:

string $body the response body:

string $service the name of the service:

string $path the path used in the request:

Return value

array The decoded content of a successful response

Throws

AuthenticationException when there is an issue authenticating the request.

InsufficientFundsException when your account is out of funds.

InvalidRequestException when the request is invalid for some other reason, e.g., invalid JSON in the POST.

HttpException when an unexpected HTTP error occurs.

WebServiceException when some other error occurs. This also serves as the base class for the above exceptions

2 calls to Client::handleResponse()
Client::get in includes/vendor/maxmind/web-service-common/src/WebService/Client.php
Client::post in includes/vendor/maxmind/web-service-common/src/WebService/Client.php

File

includes/vendor/maxmind/web-service-common/src/WebService/Client.php, line 186

Class

Client
This class is not intended to be used directly by an end-user of a MaxMind web service. Please use the appropriate client API for the service that you are using. @package MaxMind\WebService @internal

Namespace

MaxMind\WebService

Code

private function handleResponse($statusCode, $contentType, $body, $service, $path) {
  if ($statusCode >= 400 && $statusCode <= 499) {
    $this
      ->handle4xx($statusCode, $contentType, $body, $service, $path);
  }
  elseif ($statusCode >= 500) {
    $this
      ->handle5xx($statusCode, $service, $path);
  }
  elseif ($statusCode != 200) {
    $this
      ->handleUnexpectedStatus($statusCode, $service, $path);
  }
  return $this
    ->handleSuccess($body, $service);
}