mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix: AWS credential signing http request - convert form to body (#14060)
Co-authored-by: Dana <152518854+dana-gill@users.noreply.github.com>
This commit is contained in:
@@ -139,5 +139,44 @@ describe('Aws Credential', () => {
|
||||
expect(result.method).toBe('POST');
|
||||
expect(result.url).toBe('https://iam.amazonaws.com/');
|
||||
});
|
||||
|
||||
it('should handle an IRequestOptions object with form instead of body', async () => {
|
||||
const result = await aws.authenticate({ ...credentials }, {
|
||||
...requestOptions,
|
||||
body: undefined,
|
||||
form: {
|
||||
Action: 'ListUsers',
|
||||
Version: '2010-05-08',
|
||||
},
|
||||
baseURL: '',
|
||||
url: 'https://iam.amazonaws.com',
|
||||
host: 'iam.amazonaws.com',
|
||||
path: '/',
|
||||
} as IHttpRequestOptions);
|
||||
|
||||
expect(mockSign).toHaveBeenCalledWith(
|
||||
{
|
||||
...signOpts,
|
||||
form: {
|
||||
Action: 'ListUsers',
|
||||
Version: '2010-05-08',
|
||||
},
|
||||
body: 'Action=ListUsers&Version=2010-05-08',
|
||||
host: 'iam.amazonaws.com',
|
||||
url: 'https://iam.amazonaws.com',
|
||||
baseURL: '',
|
||||
path: '/',
|
||||
headers: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
// PR #14037 introduces region normalization for global endpoints
|
||||
// This test works with or without the normalization
|
||||
region: expect.stringMatching(/[a-z]{2}-[a-z]+-[0-9]+/),
|
||||
},
|
||||
securityHeaders,
|
||||
);
|
||||
expect(result.method).toBe('POST');
|
||||
expect(result.url).toBe('https://iam.amazonaws.com/');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user