Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit 7c8da6c

Browse files
author
Chris Wiechmann
committed
Lookup API now always returns a status code 200 even if
the API could not be found. Fixes issue #109
1 parent 7ebe2f6 commit 7c8da6c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

apibuilder4elastic/flows/lookupAPI-search.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,19 @@
133133
"name": "API not found",
134134
"method": "setresponse",
135135
"parameters": [
136-
{
137-
"name": "status",
138-
"type": "number",
139-
"value": "404",
140-
"metaName": "Status",
141-
"metaDescription": "The HTTP status code"
142-
},
143136
{
144137
"name": "body",
145138
"type": "jsonpath",
146139
"value": "$.error",
147140
"metaName": "Body",
148141
"metaDescription": "The response payload"
142+
},
143+
{
144+
"name": "status",
145+
"type": "number",
146+
"value": "200",
147+
"metaName": "Status",
148+
"metaDescription": "The HTTP status code"
149149
}
150150
],
151151
"outputs": {

apibuilder4elastic/test/apiLookup/test_apiLookup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ describe('Test API-Lookup endpoint', function () {
6161
});
6262
});
6363

64-
it('[apilookup-0002] Should return http 404 for an unknown API', () => {
64+
it('[apilookup-0002] Should return http 200 for an unknown API', () => {
6565
nock('https://mocked-api-gateway:8075').get('/api/portal/v1.3/proxies?field=name&op=eq&value=UnknownAPI').reply(200, '[]');
6666
return requestAsync({
6767
method: 'GET',
6868
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/lookup/api?apiName=UnknownAPI&apiPath=/any/path&groupId=XXXX`, // The groupd doesn't matter for this test
6969
auth: auth,
7070
json: true
7171
}).then(({ response, body }) => {
72-
expect(response.statusCode).to.equal(404);
72+
expect(response.statusCode).to.equal(200);
7373
expect(body).to.be.an('Object');
7474
expect(body.message).to.equal(`No APIs found with name: 'UnknownAPI'`);
7575
nock.cleanAll();

0 commit comments

Comments
 (0)