Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Nov 23, 2024
1 parent 5489889 commit fd072ca
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/redirect-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ for (const factory of [
const server = await startRedirectingServer()

const { statusCode, headers, body: bodyStream } = await request(t, server, undefined, `http://${server}/301`, {
method: 'POST',
method: 'PUT',
body: createReadable('REQUEST'),
maxRedirections: 10
})
Expand All @@ -517,6 +517,23 @@ for (const factory of [
t.strictEqual(body.length, 0)
await t.completed
})

test('should follow redirects when using Readable request bodies for POST 301', async t => {
t = tspl(t, { plan: 1 })

const server = await startRedirectingServer()

const { statusCode, body: bodyStream } = await request(t, server, undefined, `http://${server}/301`, {
method: 'POST',
body: createReadable('REQUEST'),
maxRedirections: 10
})

await bodyStream.text()

t.strictEqual(statusCode, 200)
await t.completed
})
}

test('should follow redirections when going cross origin', async t => {
Expand Down

0 comments on commit fd072ca

Please sign in to comment.