1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

API: Fixed handling of PUT method and log errors to file

This commit is contained in:
Laurent Cozic 2018-10-04 08:05:22 +01:00
parent 01470e8d3b
commit 99493174ec

View File

@ -147,6 +147,7 @@ class ClipperServer {
const response = await this.api_.route(request.method, url.pathname, url.query, body, files); const response = await this.api_.route(request.method, url.pathname, url.query, body, files);
writeResponse(200, response); writeResponse(200, response);
} catch (error) { } catch (error) {
this.logger().error(error);
writeResponse(error.httpCode ? error.httpCode : 500, error.message); writeResponse(error.httpCode ? error.httpCode : 500, error.message);
} }
} }
@ -173,7 +174,7 @@ class ClipperServer {
} }
}); });
} else { } else {
if (request.method === 'POST') { if (request.method === 'POST' || request.method === 'PUT') {
let body = ''; let body = '';
request.on('data', (data) => { request.on('data', (data) => {