diff --git a/source/core/options.ts b/source/core/options.ts index f5bff81d9..ae321d408 100644 --- a/source/core/options.ts +++ b/source/core/options.ts @@ -2521,6 +2521,5 @@ export default class Options { Object.freeze(options.retry.errorCodes); Object.freeze(options.retry.methods); Object.freeze(options.retry.statusCodes); - Object.freeze(options.context); } } diff --git a/test/arguments.ts b/test/arguments.ts index 5de4fb54f..89c706a3d 100644 --- a/test/arguments.ts +++ b/test/arguments.ts @@ -328,6 +328,18 @@ test.failing('`context` option is enumerable', withServer, async (t, server, got }); }); +test('`context` option is never frozen', t => { + const client = got.extend({ + context: { + token: 'foobar', + }, + }); + + client.defaults.options.context.token = '1234'; + + t.is(client.defaults.options.context.token, '1234'); +}); + test('`context` option is accessible when using hooks', withServer, async (t, server) => { server.get('/', echoUrl);