Skip to content

Commit d1691b4

Browse files
authored
Merge pull request #158 from avoylenko/fix-swagger-servers
Swagger servers and error logging
2 parents d3baebd + 11eb22f commit d1691b4

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { globalApiKey, disabledCallbacks } = require('./config')
44
// Trigger webhook endpoint
55
const triggerWebhook = (webhookURL, sessionId, dataType, data) => {
66
axios.post(webhookURL, { dataType, data, sessionId }, { headers: { 'x-api-key': globalApiKey } })
7-
.catch(error => console.error('Failed to send new message webhook:', sessionId, dataType, error.message, data))
7+
.catch(error => console.error('Failed to send new message webhook:', sessionId, dataType, error.message, data || ''))
88
}
99

1010
// Function to send a response with error status and message

swagger.js

+10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ const doc = {
88
title: 'WhatsApp API',
99
description: 'API Wrapper for WhatsAppWebJS'
1010
},
11+
servers: [
12+
{
13+
url: '',
14+
description: ''
15+
},
16+
{
17+
url: 'http://localhost:3000',
18+
description: 'localhost'
19+
}
20+
],
1121
securityDefinitions: {
1222
apiKeyAuth: {
1323
type: 'apiKey',

swagger.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
},
88
"servers": [
99
{
10-
"url": "http://localhost:3000/"
10+
"url": "",
11+
"description": ""
12+
},
13+
{
14+
"url": "http://localhost:3000",
15+
"description": "localhost"
1116
}
1217
],
1318
"tags": [
@@ -31,6 +36,7 @@
3136
"Various"
3237
],
3338
"description": "",
39+
"parameters": [],
3440
"responses": {
3541
"200": {
3642
"description": "OK"
@@ -411,6 +417,7 @@
411417
],
412418
"summary": "Terminate inactive sessions",
413419
"description": "Terminates all inactive sessions.",
420+
"parameters": [],
414421
"responses": {
415422
"200": {
416423
"description": "Sessions terminated.",
@@ -457,6 +464,7 @@
457464
],
458465
"summary": "Terminate all sessions",
459466
"description": "Terminates all sessions.",
467+
"parameters": [],
460468
"responses": {
461469
"200": {
462470
"description": "Sessions terminated.",

0 commit comments

Comments
 (0)