Skip to content

Commit f986bb8

Browse files
authored
fix: Don't send options connection parameter unless supplied (denodrivers#404)
1 parent 4d94baa commit f986bb8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

connection/connection.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ export class Connection {
219219
writer.addCString("application_name").addCString(
220220
this.#connection_params.applicationName,
221221
);
222-
// The database expects options in the --key=value
223-
writer.addCString("options").addCString(
224-
Object.entries(this.#connection_params.options).map(([key, value]) =>
225-
`--${key}=${value}`
226-
).join(" "),
227-
);
222+
223+
const connection_options = Object.entries(this.#connection_params.options);
224+
if (connection_options.length > 0) {
225+
// The database expects options in the --key=value
226+
writer.addCString("options").addCString(
227+
connection_options.map(([key, value]) => `--${key}=${value}`).join(" "),
228+
);
229+
}
228230

229231
// terminator after all parameters were writter
230232
writer.addCString("");

0 commit comments

Comments
 (0)