/** * @param Net_HTTP_Response $response * * @return Net_HTTP_Response */ public function dump(Net_HTTP_Response $response) { $response->header('X-Wf-Protocol-1', 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2')->header('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3')->header('X-Wf-1-Structure-1', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); $response->headers($this->convert_to_headers()); return $response; }
public static function merge_response($res1, $res2) { $res1 = Net_HTTP::Response($res1); $res2 = Net_HTTP::Response($res2); $res = new Net_HTTP_Response(); $res->status($res2->status->code != Net_HTTP::OK ? $res2->status : $res1->status); $res->headers(array_merge($res1->headers->as_array(), $res2->headers->as_array())); if (empty($res2->body)) { $res->body($res1->body); } if (empty($res1->body)) { $res->body($res2->body); } /*if ((is_string($res1->body) || $res1->body instanceof Core_StringifyInterface) && (is_string($res1->body) || $res1->body instanceof Core_StringifyInterface)) $res->body = $res1->body . $res2->body;*/ return $res; }