mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -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 = {
|
test: ICredentialTestRequest = {
|
||||||
request: {
|
request: {
|
||||||
baseURL: '={{$credentials.baseUrl}}/api/v4',
|
baseURL: '={{$credentials.baseUrl.replace(/\\/$/, "")}}/api/v4',
|
||||||
url: '/users',
|
url: '/users',
|
||||||
skipSslCertificateValidation: '={{$credentials?.allowUnauthorizedCerts}}',
|
skipSslCertificateValidation: '={{$credentials?.allowUnauthorizedCerts}}',
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,12 +19,13 @@ export async function apiRequest(
|
||||||
query: IDataObject = {},
|
query: IDataObject = {},
|
||||||
) {
|
) {
|
||||||
const credentials = await this.getCredentials('mattermostApi');
|
const credentials = await this.getCredentials('mattermostApi');
|
||||||
|
const baseUrl = (credentials.baseUrl as string).replace(/\/$/, '');
|
||||||
|
|
||||||
const options: IHttpRequestOptions = {
|
const options: IHttpRequestOptions = {
|
||||||
method,
|
method,
|
||||||
body,
|
body,
|
||||||
qs: query,
|
qs: query,
|
||||||
url: `${credentials.baseUrl}/api/v4/${endpoint}`,
|
url: `${baseUrl}/api/v4/${endpoint}`,
|
||||||
headers: {
|
headers: {
|
||||||
'content-type': 'application/json; charset=utf-8',
|
'content-type': 'application/json; charset=utf-8',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue