diff options
Diffstat (limited to 'test/redirect-relative.js')
-rw-r--r-- | test/redirect-relative.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/redirect-relative.js b/test/redirect-relative.js new file mode 100644 index 0000000..ca9c541 --- /dev/null +++ b/test/redirect-relative.js @@ -0,0 +1,22 @@ +'use strict' + +const t = require('tap') +const { request } = require('..') +const { + startRedirectingWithRelativePath +} = require('./utils/redirecting-servers') + +t.test('should redirect to relative URL according to RFC 7231', async t => { + t.plan(2) + + const server = await startRedirectingWithRelativePath(t) + + const { statusCode, body } = await request(`http://${server}`, { + maxRedirections: 3 + }) + + const finalPath = await body.text() + + t.equal(statusCode, 200) + t.equal(finalPath, '/absolute/b') +}) |