mirror of https://github.com/actions/toolkit
pipeResponseToFile already throws when reading truncated stream
parent
a600dd34a5
commit
dc491a61ca
|
@ -196,7 +196,6 @@ describe('Download Tests', () => {
|
||||||
const targetPath = path.join(root, 'FileD.txt')
|
const targetPath = path.join(root, 'FileD.txt')
|
||||||
|
|
||||||
setupDownloadItemResponse(true, 200, true, fileContents, true)
|
setupDownloadItemResponse(true, 200, true, fileContents, true)
|
||||||
setupThrowWhenReadingStream()
|
|
||||||
const downloadHttpClient = new DownloadHttpClient()
|
const downloadHttpClient = new DownloadHttpClient()
|
||||||
|
|
||||||
const items: DownloadItem[] = []
|
const items: DownloadItem[] = []
|
||||||
|
@ -292,18 +291,6 @@ describe('Download Tests', () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupThrowWhenReadingStream(): void {
|
|
||||||
jest
|
|
||||||
.spyOn(DownloadHttpClient.prototype, 'pipeResponseToFile')
|
|
||||||
.mockImplementationOnce(async () => {
|
|
||||||
return new Promise<void>(() => {
|
|
||||||
throw new Error(
|
|
||||||
'simulate GZip reading truncated buffer and throw Z_BUF_ERROR'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setups up HTTP GET response for downloading items
|
* Setups up HTTP GET response for downloading items
|
||||||
* @param isGzip is the downloaded item gzip encoded
|
* @param isGzip is the downloaded item gzip encoded
|
||||||
|
|
Loading…
Reference in New Issue