Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-ui-express

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-ui-express - npm Package Compare versions

Comparing version 4.3.0 to 4.4.0

21

index.js

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

function trimQuery(q) {
return q && q.split('?')[0]
}
var htmlTplString = `

@@ -82,2 +86,3 @@ <!-- HTML for static distribution bundle build -->

<% customJs %>
<% customJsStr %>
<% customCssUrl %>

@@ -141,2 +146,3 @@ <style>

var customJs
var customJsStr
var swaggerUrls

@@ -148,2 +154,3 @@ var customCssUrl

customJs = opts.customJs
customJsStr = opts.customJsStr
customfavIcon = opts.customfavIcon

@@ -170,3 +177,4 @@ swaggerUrl = opts.swaggerUrl

var htmlWithFavIcon = htmlWithCustomCss.replace('<% favIconString %>', favIconString)
var htmlWithCustomJs = htmlWithFavIcon.replace('<% customJs %>', customJs ? `<script src="${customJs}"></script>` : '')
var htmlWithCustomJsUrl = htmlWithFavIcon.replace('<% customJs %>', customJs ? `<script src="${customJs}"></script>` : '')
var htmlWithCustomJs = htmlWithCustomJsUrl.replace('<% customJsStr %>', customJsStr ? `<script>${customJsStr}</script>` : '')
var htmlWithCustomCssUrl = htmlWithCustomJs.replace('<% customCssUrl %>', customCssUrl ? `<link href="${customCssUrl}" rel="stylesheet">` : '')

@@ -198,5 +206,5 @@

function swaggerInitFn(req, res, next) {
if (req.url === '/package.json') {
if (trimQuery(req.url) === '/package.json') {
res.sendStatus(404)
} else if (req.url === '/swagger-ui-init.js') {
} else if (trimQuery(req.url) === '/swagger-ui-init.js') {
res.set('Content-Type', 'application/javascript')

@@ -212,5 +220,8 @@ res.send(swaggerInit)

return function (req, res, next) {
if (req.url === '/package.json') {
if (trimQuery(req.url) === '/package.json') {
res.sendStatus(404)
} else if (req.url === '/swagger-ui-init.js') {
} else if (trimQuery(req.url) === '/swagger-ui-init.js') {
if (req.swaggerDoc) {
swaggerInitFile = jsTplString.toString().replace('<% swaggerOptions %>', stringify(opts))
}
res.set('Content-Type', 'application/javascript')

@@ -217,0 +228,0 @@ res.send(swaggerInitFile)

{
"name": "swagger-ui-express",
"version": "4.3.0",
"version": "4.4.0",
"description": "Swagger UI Express",

@@ -53,3 +53,3 @@ "main": "./index.js",

"dependencies": {
"swagger-ui-dist": ">=4.1.3"
"swagger-ui-dist": ">=4.11.0"
},

@@ -56,0 +56,0 @@ "peerDependencies": {

@@ -226,2 +226,4 @@ # Swagger UI Express

var options = {}
app.use('/api-docs', function(req, res, next){

@@ -231,3 +233,3 @@ swaggerDocument.host = req.get('host');

next();
}, swaggerUi.serve, swaggerUi.setup());
}, swaggerUi.serveFiles(swaggerDocument, options), swaggerUi.setup());
```

@@ -234,0 +236,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc