Skip to content

Commit

Permalink
fix error not thrown when secure param is passed (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanagarajkm authored and kannappanr committed Sep 4, 2018
1 parent 9d8b62b commit ca0f575
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/minio.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var Package = require('../../package.json')

export class Client {
constructor(params) {
if (params.secure) throw new Error('"secure" option deprecated, "useSSL" should be used instead')
if (typeof params.secure !== 'undefined') throw new Error('"secure" option deprecated, "useSSL" should be used instead')
// Default values if not specified.
if (typeof params.useSSL === 'undefined') params.useSSL = true
if (!params.port) params.port = 0
Expand Down
26 changes: 26 additions & 0 deletions src/test/unit/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,32 @@ describe('Client', function() {
done()
}
})
it('should fail when secure param is passed', (done) => {
try {
new Minio.Client({
endPoint: 'localhost',
secure: false,
port: 9000,
accessKey: 'accesskey',
secretKey: 'secretkey'
})
} catch (e) {
done()
}
})
it('should fail when secure param is passed', (done) => {
try {
new Minio.Client({
endPoint: 'localhost',
secure: true,
port: 9000,
accessKey: 'accesskey',
secretKey: 'secretkey'
})
} catch (e) {
done()
}
})
})
describe('Presigned URL', () => {
describe('presigned-get', () => {
Expand Down

0 comments on commit ca0f575

Please sign in to comment.