Skip to content

Commit 260ff9d

Browse files
authored
fix(cloud-sql): added return statements to fix 'http headers sent' error (#1883)
fixes #1882
1 parent 2e9428d commit 260ff9d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cloud-sql/mysql/mysql/server.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ app.post('/', async (req, res) => {
192192
const timestamp = new Date();
193193

194194
if (!team || (team !== 'TABS' && team !== 'SPACES')) {
195-
res.status(400).send('Invalid team specified.').end();
195+
return res.status(400).send('Invalid team specified.').end();
196196
}
197197

198198
// [START cloud_sql_mysql_mysql_connection]
@@ -206,7 +206,7 @@ app.post('/', async (req, res) => {
206206
// involve retrying or adjusting parameters depending on the situation.
207207
// [START_EXCLUDE]
208208
logger.error(err);
209-
res
209+
return res
210210
.status(500)
211211
.send(
212212
'Unable to successfully cast vote! Please check the application logs for more details.'

cloud-sql/sqlserver/mssql/server.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ app.post('/', async (req, res, next) => {
175175
const timestamp = new Date();
176176

177177
if (!team || (team !== 'TABS' && team !== 'SPACES')) {
178-
res.status(400).send('Invalid team specified.').end();
178+
return res.status(400).send('Invalid team specified.').end();
179179
}
180180

181181
// [START cloud_sql_server_mssql_connection]
@@ -199,7 +199,7 @@ app.post('/', async (req, res, next) => {
199199
// [START_EXCLUDE]
200200

201201
logger.error(err);
202-
res
202+
return res
203203
.status(500)
204204
.send(
205205
'Unable to successfully cast vote! Please check the application logs for more details.'

0 commit comments

Comments
 (0)