make the request body.

@param array $pointHeaders
@param array $data

@return array
516626
protected function makeBody($pointHeaders, $data)
    {
        unset($data['uriData']);
        $apiHeaders = array_map(function ($value) {
            return $value->get();
        }, $this->api->getHeaders()->get());

        $dataChain = $this->endpoint->getMethod() == 'GET' ? 'query' : 'json';
        $body = array_merge($apiHeaders, $pointHeaders);
        $body[$dataChain] = $data;

        $request = new Request($body, $this->endpoint->getTransformer('request'), $dataChain);

        return $request->getBody($dataChain);
    }
786338
public function post($endpoint, array $data = [])
    {
        $body = json_encode($data);
        $request = $this->createRequest('POST', $endpoint, $body, ['Content-Type' => 'application/json']);
        return $this->sendRequest($request);
    }
20324
protected function jsonResponse($data = array(), $status = 200, array $headers = array(), $options = 0)
	{
		if ($data instanceof JsonSerializable) {
			$data = $data->jsonSerialize();
		} else if ($data instanceof ArrayableInterface) {
			$data = $data->toArray();
		}

		return new JsonResponse($data, $status, $headers, $options);
	}
1263517
public function void(string $id, array $data, array $headers = [])
    {
        $url = $this->url('invoices/%s/void', $id);

        return $this->post($url, $data, $headers);
    }
240304
public function json($data = [], $status = 200, array $headers = [], $options = 0)
    {
        return new JsonResponse($data, $status, $headers, $options);
    }
651735
public function sendData($data)
    {
        $endpoint = $this->getEndpoint();
        $headers = array(
            'Content-Type' => 'text/xml; charset=utf-8',
            'SOAPAction' => $endpoint.'/'.$this->getMethod(),
        );

        $httpResponse = $this->httpClient->post($endpoint, $headers, $data)->send();

        return $this->createResponse($httpResponse->xml());
    }
1231064
public function head($url, array $data = [], array $options = [])
    {
        $options = $this->_mergeOptions($options);
        $url = $this->buildUrl($url, $data, $options);

        return $this->_doRequest(Request::METHOD_HEAD, $url, '', $options);
    }
346816
public function respond(array $data = [], array $headers = []): JsonResponse
    {
        $meta = [
            'meta' => [
                'server_time' => time(),
                'server_timezone' => date_default_timezone_get(),
                'api_version' => 'v1',
            ],
        ];

        return response()->json(array_merge($data, $meta), $this->getStatusCode(), $headers);
    }
1241216
public static function requestApi(array $data): Collection
    {
        Events::dispatch(Events::API_REQUESTING, new Events\ApiRequesting('Alipay', '', self::$instance->getBaseUri(), $data));

        $data = array_filter($data, function ($value) {
            return ($value == '' || is_null($value)) ? false : true;
        });

        $result = mb_convert_encoding(self::$instance->post('', $data), 'utf-8', 'gb2312');

        $result = json_decode($result, true);

        Events::dispatch(Events::API_REQUESTED, new Events\ApiRequested('Alipay', '', self::$instance->getBaseUri(), $result));

        return self::processingApiResult($data, $result);
    }
785847
public static function makeFromApi(array $data)
    {
        if (isset($data['type'])) {
            switch ($data['type']) {
                case Type::TEXT:
                    return new Text($data);
                case Type::URL:
                    return new Url($data);
                case Type::PICTURE:
                    return new Picture($data);
                case Type::CONTACT:
                    return new Contact($data);
                case Type::VIDEO:
                    return new Video($data);
                case Type::FILE:
                    return new File($data);
                case Type::STICKER:
                    return new Sticker($data);
                case Type::LOCATION:
                    return new Location($data);
            }
        }
        throw new ApiException('Unknow message data');
    }
278323
public function add(array $data, array $headers = [])
    {
        $url = $this->url('promotional_credits/add');

        return $this->post($url, $data, $headers);
    }
1111352
protected function respond($data, $headers = [])
    {
        $this->setResponseHeaders($headers);

        return response()->json($data, $this->getStatusCode(), $this->getResponseHeaders());
    }
1346840
private function makeTableBody($headers, $rows)
    {
        $body = [];
        $tableCellWidth = ($this->option('w')) ? $this->option('w') : 10;
        for ($i = 0; $i < count($rows); $i++) {
            $row = [];
            for ($j = 0; $j < count($headers); $j++) {
                $column = $headers[$j];
                $row[$j] = str_limit($rows[$i]->$column, $tableCellWidth, '');
            }
            $body[$i] = $row;
        }
        return $body;
    }
74805
public function json( $data = [], $status = 200, array $headers = [], $options = 0 )
	{
		if ( $data instanceof Arrayable && !$data instanceof JsonSerializable )
			$data = $data->toArray();

		return new JsonResponse( $data, $status, $headers, $options );
	}
991488
public static function setHeaders(array $data, array $attributes = array()) {
        foreach ($data as $header) {
            self::addHeader($header, $attributes);
        }
    }
969655
public function post($url, $data, $headers = [])
    {
        $request = new Request('POST', $url, $headers);
        $response = $this->apiClient->send(
            $request,
            [
                'form_params' => $data,
            ]
        );
        $result = json_decode($response->getBody(), true);
        return $result;
    }
1199946
public function deduct(array $data, array $headers = [])
    {
        $url = $this->url('promotional_credits/deduct');

        return $this->post($url, $data, $headers);
    }