add log
This commit is contained in:
parent
d561a06ba2
commit
c5a73d57da
|
@ -65,6 +65,8 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
#sendApiError(reply: FastifyReply, err: ApiError): void {
|
#sendApiError(reply: FastifyReply, err: ApiError): void {
|
||||||
|
this.logger.error(err);
|
||||||
|
|
||||||
let statusCode = err.httpStatusCode;
|
let statusCode = err.httpStatusCode;
|
||||||
if (err.httpStatusCode === 401) {
|
if (err.httpStatusCode === 401) {
|
||||||
reply.header('WWW-Authenticate', 'Bearer realm="Misskey"');
|
reply.header('WWW-Authenticate', 'Bearer realm="Misskey"');
|
||||||
|
|
|
@ -62,6 +62,15 @@ export class ApiServerService {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fastify.addHook('onSend', (request, reply, payload, next) => {
|
||||||
|
console.log('---- Request:', request.method, request.url);
|
||||||
|
console.log('---- body:', request.body);
|
||||||
|
|
||||||
|
console.log('---- Response:', reply.statusCode);
|
||||||
|
console.log('---- Response:', payload);
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
for (const endpoint of endpoints) {
|
for (const endpoint of endpoints) {
|
||||||
const ep = {
|
const ep = {
|
||||||
name: endpoint.name,
|
name: endpoint.name,
|
||||||
|
|
Loading…
Reference in New Issue