mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix(Mattermost Node): Fix base url trailing slash error (#6097)
* 🐛 Fix credential base url with trailing slash
* Fix credential test base url with trailing slash
This commit is contained in:
parent
c65ac03368
commit
25a386dd70
|
@ -46,7 +46,7 @@ export class MattermostApi implements ICredentialType {
|
|||
|
||||
test: ICredentialTestRequest = {
|
||||
request: {
|
||||
baseURL: '={{$credentials.baseUrl}}/api/v4',
|
||||
baseURL: '={{$credentials.baseUrl.replace(/\\/$/, "")}}/api/v4',
|
||||
url: '/users',
|
||||
skipSslCertificateValidation: '={{$credentials?.allowUnauthorizedCerts}}',
|
||||
},
|
||||
|
|
|
@ -19,12 +19,13 @@ export async function apiRequest(
|
|||
query: IDataObject = {},
|
||||
) {
|
||||
const credentials = await this.getCredentials('mattermostApi');
|
||||
const baseUrl = (credentials.baseUrl as string).replace(/\/$/, '');
|
||||
|
||||
const options: IHttpRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs: query,
|
||||
url: `${credentials.baseUrl}/api/v4/${endpoint}`,
|
||||
url: `${baseUrl}/api/v4/${endpoint}`,
|
||||
headers: {
|
||||
'content-type': 'application/json; charset=utf-8',
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue