Requests_Session::merge_request()
最后更新于:2021-11-26 04:04:07
Requests_Session::merge_request( array$request, boolean$merge_options=true)Merge a request’s data with the default data
参数
- $request
-
(array) (Required) Request data (same form as request_multiple)
- $merge_options
-
(boolean) (Optional) Should we merge options as well?
Default value: true
响应
(array) Request data
源文件
文件: gc-includes/Requests/Session.php
protected function merge_request($request, $merge_options = true) {
if ($this->url !== null) {
$request['url'] = Requests_IRI::absolutize($this->url, $request['url']);
$request['url'] = $request['url']->uri;
}
if (empty($request['headers'])) {
$request['headers'] = array();
}
$request['headers'] = array_merge($this->headers, $request['headers']);
if (empty($request['data'])) {
if (is_array($this->data)) {
$request['data'] = $this->data;
}
}
elseif (is_array($request['data']) && is_array($this->data)) {
$request['data'] = array_merge($this->data, $request['data']);
}
if ($merge_options !== false) {
$request['options'] = array_merge($this->options, $request['options']);
// Disallow forcing the type, as that's a per request setting
unset($request['options']['type']);
}
return $request;
}