fix: pass full response headers in net module (#21552)

This commit is contained in:
Cheng Zhao 2020-01-15 02:36:08 +09:00 committed by Jeremy Apthorp
parent 2d0bf81bd4
commit ceacadb4f4
3 changed files with 63 additions and 13 deletions

View file

@ -616,6 +616,23 @@ describe('net module', () => {
})
})
it('should be able to receive cookies', (done) => {
const cookie = ['cookie1', 'cookie2']
respondOnce.toSingleURL((request, response) => {
response.statusCode = 200
response.statusMessage = 'OK'
response.setHeader('set-cookie', cookie)
response.end()
}).then(serverUrl => {
const urlRequest = net.request(serverUrl)
urlRequest.on('response', (response) => {
expect(response.headers['set-cookie']).to.have.same.members(cookie)
done()
})
urlRequest.end()
})
})
it('should be able to abort an HTTP request before first write', async () => {
const serverUrl = await respondOnce.toSingleURL((request, response) => {
response.end()