@trojs/openapi-server 1.13.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api.js +2 -1
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import express from 'express'
|
|
2
2
|
import swaggerUi from 'swagger-ui-express'
|
|
3
|
+
import crypto from 'node:crypto'
|
|
3
4
|
import { setupRouter } from './router.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -97,7 +98,7 @@ export class Api {
|
|
|
97
98
|
if (this.apiDocs) {
|
|
98
99
|
// Generate an ETag for the specification (simple hash or JSON string)
|
|
99
100
|
const apiDocsString = JSON.stringify(this.specification)
|
|
100
|
-
const etag = `"${
|
|
101
|
+
const etag = `"${crypto.createHash('sha256').update(apiDocsString).digest('base64')}"`
|
|
101
102
|
|
|
102
103
|
router.get('/api-docs', (request, response) => {
|
|
103
104
|
// Check for If-None-Match header
|