The new config fields for options.https are not merged correctly when extend a got instance.
If you have an instance of got that has some config of options.https and provide a new one then the resulted instance should has a merged verison.
const { describe, it } = require('mocha')
const Got = require('got')
const { deepEqual } = require('assert').strict
describe('Got https options', function () {
it('should merge http options', function () {
const got1 = Got.extend({ https: { certificateAuthority: 'TestCertificate' } })
const got2 = Got.extend(got1, { https: { key: 'TestKey' } })
deepEqual(got2.defaults.options.https, {
certificateAuthority: 'TestCertificate',
key: 'TestKey'
})
})
})
You are right, currently the entire https object is merged, not the single options inside it.
@szmarczak I really haven't thought about it, if you think that it should merge every single options I can fix it.
We should do deep merge. That鈥檚 the expected behavior.
Most helpful comment
We should do deep merge. That鈥檚 the expected behavior.