fix: current cookie endpoint path
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
@@ -60,9 +60,11 @@ export default class HTTPServer {
|
||||
const server = http.createServer(
|
||||
(request: http.IncomingMessage, response: http.ServerResponse) => {
|
||||
// This endpoind is used by the frontend to issue a cookie for the user.
|
||||
// It is necessary because the MkDocs server doesn't expose it.
|
||||
if (request.url === '/api/techdocs/.backstage/v1-cookie') {
|
||||
const expiresAt = new Date(Date.now() + 60 * 60 * 1000);
|
||||
// But the MkDocs server doesn't expose it as a the Backestage backend does.
|
||||
// So we need to fake it here to prevent 404 errors.
|
||||
if (request.url === '/api/techdocs/cookie') {
|
||||
const oneHourInMilliseconds = 60 * 60 * 1000;
|
||||
const expiresAt = new Date(Date.now() + oneHourInMilliseconds);
|
||||
const cookie = { expiresAt: expiresAt.toISOString() };
|
||||
response.setHeader('Content-Type', 'application/json');
|
||||
response.end(JSON.stringify(cookie));
|
||||
|
||||
Reference in New Issue
Block a user