fastify-swagger
Advanced tools
Comparing version 0.10.1 to 0.10.2
{ | ||
"name": "fastify-swagger", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "Generate Swagger files automatically for Fastify.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,3 +10,3 @@ 'use strict' | ||
schema: { hide: true }, | ||
handler: (request, reply) => reply.redirect(`${fastify.basePath}/index.html`) | ||
handler: (request, reply) => reply.redirect(path.join(fastify.basePath, 'index.html')) | ||
}) | ||
@@ -13,0 +13,0 @@ |
@@ -246,2 +246,23 @@ 'use strict' | ||
test('with routePrefix: \'/\' should redirect to /index.html', t => { | ||
t.plan(4) | ||
const fastify = Fastify() | ||
const opts = JSON.parse(JSON.stringify(swaggerInfo)) | ||
opts.routePrefix = '/' | ||
fastify.register(fastifySwagger, opts) | ||
fastify.get('/foo', () => {}) | ||
fastify.inject({ | ||
method: 'GET', | ||
url: '/' | ||
}, (err, res) => { | ||
t.error(err) | ||
t.strictEqual(res.statusCode, 302) | ||
t.strictEqual(res.headers['location'], '/index.html') | ||
t.is(typeof res.payload, 'string') | ||
}) | ||
}) | ||
test('/documentation/:file should send back the correct file', t => { | ||
@@ -248,0 +269,0 @@ t.plan(21) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19608915
11239