diff --git tests/phpunit/tests/admin/includesFile.php tests/phpunit/tests/admin/includesFile.php
index a3af5da2d1..94549354fb 100644
--- tests/phpunit/tests/admin/includesFile.php
+++ tests/phpunit/tests/admin/includesFile.php
@@ -77,4 +77,31 @@ class Tests_Admin_includesFile extends WP_UnitTestCase {
 	public function __return_5() {
 		return 5;
 	}
+
+	/**
+	 * @ticket 38231
+	 */
+	public function test_download_url_filename_from_content_disposition_header() {
+		add_filter( 'pre_http_request', array( $this, '_fake_download_url_with_content_disposition_header' ), 10, 3 );
+
+		$filename = download_url( 'url_with_content_disposition_header' );
+
+		$this->assertContains( 'filename-from-content-disposition-header', $filename );
+		$this->assertFileExists( $filename );
+
+		$this->unlink( $filename );
+
+		remove_filter( 'pre_http_request', array( $this, '_fake_download_url_with_content_disposition_header' ) );
+	}
+
+	public function _fake_download_url_with_content_disposition_header( $response, $args, $url ) {
+		return array(
+			'response' => array(
+				'code' => 200,
+			),
+			'headers'  => array(
+				'Content-Disposition' => 'filename="filename-from-content-disposition-header.txt"',
+			),
+		);
+	}
 }
