@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/api.js +2 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@trojs/openapi-server",
3
3
  "description": "OpenAPI Server",
4
- "version": "1.13.0",
4
+ "version": "1.13.1",
5
5
  "author": {
6
6
  "name": "Pieter Wigboldus",
7
7
  "url": "https://trojs.org/"
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 = `"${Buffer.from(apiDocsString).toString('base64')}"`
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