Skip to content

Commit

Permalink
fix(mongodb+srv): respect overriding SRV-provided properties
Browse files Browse the repository at this point in the history
This PR fixes the spec test and corrects the behavior of the TXT record
overriding the querystring by reversing the merge.

NODE-2335
  • Loading branch information
mpilar authored and mbroadst committed Nov 25, 2019
1 parent 08ee53e commit 5ed4c07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/core/uri_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function parseSrvConnectionString(uri, options, callback) {
);
}

Object.assign(result.query, record);
result.query = Object.assign({}, record, result.query);
}

// Set completed options back into the URL object.
Expand Down
4 changes: 4 additions & 0 deletions test/core/unit/mongodb_srv_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ describe('mongodb+srv', function() {
expect(result.options.ssl).to.equal(test[1].options.ssl);
}

if (test[1].options && test[1].options.authSource) {
expect(result.options.authsource).to.equal(test[1].options.authSource);
}

if (
test[1].parsed_options &&
test[1].parsed_options.user &&
Expand Down

0 comments on commit 5ed4c07

Please sign in to comment.