php/WP_CLI/WpHttpCacheManager.php
public function filter_http_response( $response, $args, $url ) {
		// check if whitelisted
		if ( ! isset( $this->whitelist[ $url ] ) ) {
			return $response;
		}
		// check if downloading
		if ( 'GET' !== $args['method'] || empty( $args['filename'] ) ) {
			return $response;
		}
		// check if download was successful
		if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
			return $response;
		}
		// cache downloaded file
		$this->cache->import( $this->whitelist[ $url ]['key'], $response['filename'] );
		return $response;
	}
public function filter_http_response( $response, $args, $url ) {
		// check if whitelisted
		if ( ! isset( $this->whitelist[ $url ] ) ) {
			return $response;
		}
		// check if downloading
		if ( 'GET' !== $args['method'] || empty( $args['filename'] ) ) {
			return $response;
		}
		// check if download was successful
		if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
			return $response;
		}
		// cache downloaded file
		$this->cache->import( $this->whitelist[ $url ]['key'], $response['filename'] );
		return $response;
	}
public function filter_http_response ( $ response , $ args , $ url ) { // check if whitelisted if ( ! isset ( $ this -> whitelist [ $ url ] ) ) { return $ response ; } // check if downloading if ( 'GET' !== $ args [ 'method' ] || empty ( $ args [ 'filename' ] ) ) { return $ response ; } // check if download was successful if ( is_wp_error ( $ response ) || 200 !== wp_remote_retrieve_response_code ( $ response ) ) { return $ response ; } // cache downloaded file $ this -> cache -> import ( $ this -> whitelist [ $ url ] [ 'key' ] , $ response [ 'filename' ] ) ; return $ response ; }
cache wp http api downloads

@param array $response
@param array $args
@param string $url
cache wp http api downloads