Skip to content

Commit 7052123

Browse files
authored
Merge pull request #8707 from sbalagan22/fix/8695-ntlm-domain-guard
fix(lang): guard ntlm domain on domainKey, not passwordKey
2 parents a7468bd + e2829a7 commit 7052123

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

packages/bruno-lang/v2/src/bruToJson.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ const sem = grammar.createSemantics().addAttribute('ast', {
806806

807807
const username = usernameKey ? usernameKey.value : '';
808808
const password = passwordKey ? passwordKey.value : '';
809-
const domain = passwordKey ? domainKey.value : '';
809+
const domain = domainKey ? domainKey.value : '';
810810

811811
return {
812812
auth: {

packages/bruno-lang/v2/tests/bruToJson.spec.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,4 +1045,37 @@ headers {
10451045
});
10461046
});
10471047
});
1048+
1049+
describe('auth:ntlm', () => {
1050+
it('should parse ntlm auth with a domain', () => {
1051+
const input = `
1052+
auth:ntlm {
1053+
username: u
1054+
password: p
1055+
domain: d
1056+
}`.trim();
1057+
1058+
const output = parser(input);
1059+
expect(output.auth.ntlm).toEqual({
1060+
username: 'u',
1061+
password: 'p',
1062+
domain: 'd'
1063+
});
1064+
});
1065+
1066+
it('should default domain to empty string when the domain line is absent', () => {
1067+
const input = `
1068+
auth:ntlm {
1069+
username: u
1070+
password: p
1071+
}`.trim();
1072+
1073+
const output = parser(input);
1074+
expect(output.auth.ntlm).toEqual({
1075+
username: 'u',
1076+
password: 'p',
1077+
domain: ''
1078+
});
1079+
});
1080+
});
10481081
});

0 commit comments

Comments
 (0)