Skip to content

Commit 2bf56f2

Browse files
authored
Merge pull request #3 from SearchApi/fix/credential-test
Adds credentials test to n8n node
2 parents 3264685 + 4f4d03c commit 2bf56f2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

credentials/SearchApi.credentials.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
IAuthenticateGeneric,
3+
ICredentialTestRequest,
34
ICredentialType,
45
INodeProperties,
56
} from 'n8n-workflow';
@@ -30,4 +31,14 @@ export class SearchApi implements ICredentialType {
3031
}
3132
}
3233
};
34+
test?: ICredentialTestRequest | undefined = {
35+
request: {
36+
baseURL: 'https://www.searchapi.io/api/v1/me',
37+
method: 'GET',
38+
qs: { api_key: '={{ $credentials.apiKey }}' },
39+
headers: {
40+
"X-SearchApi-Source": "N8N"
41+
}
42+
}
43+
}
3344
}

nodes/SearchApi/SearchApi.node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class SearchApi implements INodeType {
2222
credentials: [{ name: 'searchApi', required: true }],
2323
usableAsTool: true,
2424
requestDefaults: {
25-
baseURL: 'http://localhost:3000/api/v1', // TODO: Change to https://www.searchapi.io/api/v1
25+
baseURL: 'https://www.searchapi.io/api/v1',
2626
method: 'GET',
2727
url: '/search',
2828
headers: { Accept: 'application/json' },

0 commit comments

Comments
 (0)