enhance(backend): restore OpenAPI endpoints (#10281)
* enhance(backend): restore OpenAPI endpoints * Update CHANGELOG.md * version * set max-age * update redoc * follow redoc documentation --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
This commit is contained in:
parent
caf646fcb0
commit
e0b7633a7a
10 changed files with 270 additions and 29 deletions
|
@ -13,6 +13,7 @@ const UNSPECIFIED = '*/*';
|
|||
// Response Content-Type
|
||||
const AP = 'application/activity+json; charset=utf-8';
|
||||
const HTML = 'text/html; charset=utf-8';
|
||||
const JSON_UTF8 = 'application/json; charset=utf-8';
|
||||
|
||||
describe('Fetch resource', () => {
|
||||
let p: INestApplicationContext;
|
||||
|
@ -52,14 +53,17 @@ describe('Fetch resource', () => {
|
|||
assert.strictEqual(res.type, HTML);
|
||||
});
|
||||
|
||||
test('GET api-doc (廃止)', async () => {
|
||||
test('GET api-doc', async () => {
|
||||
const res = await simpleGet('/api-doc');
|
||||
assert.strictEqual(res.status, 404);
|
||||
assert.strictEqual(res.status, 200);
|
||||
// fastify-static gives charset=UTF-8 instead of utf-8 and that's okay
|
||||
assert.strictEqual(res.type?.toLowerCase(), HTML);
|
||||
});
|
||||
|
||||
test('GET api.json (廃止)', async () => {
|
||||
test('GET api.json', async () => {
|
||||
const res = await simpleGet('/api.json');
|
||||
assert.strictEqual(res.status, 404);
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(res.type, JSON_UTF8);
|
||||
});
|
||||
|
||||
test('GET api/foo (存在しない)', async () => {
|
||||
|
@ -68,6 +72,12 @@ describe('Fetch resource', () => {
|
|||
assert.strictEqual(res.body.error.code, 'UNKNOWN_API_ENDPOINT');
|
||||
});
|
||||
|
||||
test('GET api-console (client page)', async () => {
|
||||
const res = await simpleGet('/api-console');
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(res.type, HTML);
|
||||
});
|
||||
|
||||
test('GET favicon.ico', async () => {
|
||||
const res = await simpleGet('/favicon.ico');
|
||||
assert.strictEqual(res.status, 200);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue