/**
  * @see HTTPS_Resource_Proxy::send_proxy_response()
  * @see HTTPS_Resource_Proxy::handle_proxy_request()
  */
 function test_send_proxy_response_successes()
 {
     $instance = new HTTPS_Resource_Proxy($this->plugin);
     add_filter('https_resource_proxy_filtering_enabled', '__return_true');
     $params = array('nonce' => wp_create_nonce(HTTPS_Resource_Proxy::MODULE_SLUG), 'host' => 'example.org', 'path' => '/main.js');
     $this->filter_pre_http_request(array('headers' => array('content-type' => 'text/javascript', 'etag' => '"abc123"', 'last-modified' => gmdate('r', time() - 10), 'expires' => gmdate('r', time() + 10), 'x-foo' => 'bar'), 'body' => 'alert( 1 );'));
     $r1 = $instance->send_proxy_response($params);
     $this->assertArrayHasKey('response', $r1);
     $this->assertArrayHasKey('headers', $r1);
     $this->assertArrayHasKey('body', $r1);
     $this->assertEquals(200, wp_remote_retrieve_response_code($r1));
     $this->assertNotEmpty(wp_remote_retrieve_body($r1));
     $this->assertArrayHasKey('etag', $r1['headers']);
     $this->assertArrayNotHasKey('x-foo', $r1['headers']);
     remove_all_filters('pre_http_request');
     add_filter('pre_http_request', function () {
         throw new Exception('pre_http_request should not have been called due to transient');
     });
     $r2 = $instance->send_proxy_response($params);
     $this->assertEquals($r1, $r2);
     $params['if_modified_since'] = $r1['headers']['last-modified'];
     $r3 = $instance->send_proxy_response($params);
     $this->assertEquals(304, wp_remote_retrieve_response_code($r3));
     $this->assertEmpty(wp_remote_retrieve_body($r3));
     unset($params['if_modified_since']);
     $params['if_none_match'] = '"abc123"';
     $r4 = $instance->send_proxy_response($params);
     $this->assertEquals(304, wp_remote_retrieve_response_code($r4));
 }