Socket
Socket
Sign inDemoInstall

swagger-ui-express

Package Overview
Dependencies
0
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.2 to 3.0.3

swagger-ui-init.js

14

index.js

@@ -9,2 +9,3 @@ 'use strict'

var swaggerInit
var setup = function (swaggerDoc, opts, options, customCss, customfavIcon, swaggerUrl, customeSiteTitle) {

@@ -42,2 +43,4 @@ var isExplorer

var initOptions = {

@@ -48,3 +51,5 @@ swaggerDoc: swaggerDoc || undefined,

}
var htmlWithOptions = htmlWithCustomJs.replace('<% swaggerOptions %>', JSON.stringify(initOptions)).replace('<% title %>', customeSiteTitle)
var js = fs.readFileSync(__dirname + '/swagger-ui-init.js');
swaggerInit = js.toString().replace('<% swaggerOptions %>', stringify(initOptions))
var htmlWithOptions = htmlWithCustomJs.replace('<% title %>', customeSiteTitle)

@@ -54,3 +59,3 @@ return function (req, res) { res.send(htmlWithOptions) };

function swaggerInit (req, res, next) {
function swaggerInitFn (req, res, next) {
if (req.url === '/swagger-ui-init.js') {

@@ -63,5 +68,6 @@ res.send(swaggerInit)

var serve = express.static(__dirname + '/static');
var serveWithOptions = options => express.static(__dirname + '/static', options);
var serve = [swaggerInitFn, express.static(__dirname + '/static')];
var serveWithOptions = options => [swaggerInitFn, express.static(__dirname + '/static', options)];
var stringify = function (obj, prop) {

@@ -68,0 +74,0 @@ var placeholder = '____FUNCTIONPLACEHOLDER____';

{
"name": "swagger-ui-express",
"version": "3.0.2",
"version": "3.0.3",
"description": "Swagger UI Express",

@@ -10,3 +10,4 @@ "main": "./lib/index.js",

"index.js",
"indexTemplate.html"
"indexTemplate.html",
"swagger-ui-init.js"
],

@@ -13,0 +14,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc