mirror of
https://github.com/zadam/trilium.git
synced 2025-01-29 02:18:18 +08:00
fix uploading binary data through ETAPI, closes #2667
This commit is contained in:
parent
d940590add
commit
9f33791922
3 changed files with 28 additions and 0 deletions
|
@ -25,6 +25,7 @@ app.use(helmet({
|
||||||
|
|
||||||
app.use(express.text({limit: '500mb'}));
|
app.use(express.text({limit: '500mb'}));
|
||||||
app.use(express.json({limit: '500mb'}));
|
app.use(express.json({limit: '500mb'}));
|
||||||
|
app.use(express.raw({limit: '500mb'}));
|
||||||
app.use(express.urlencoded({extended: false}));
|
app.use(express.urlencoded({extended: false}));
|
||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
app.use(express.static(path.join(__dirname, 'public')));
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
|
|
25
test-etapi/put-note-content-binary.http
Normal file
25
test-etapi/put-note-content-binary.http
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
POST {{triliumHost}}/etapi/create-note
|
||||||
|
Authorization: {{authToken}}
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"parentNoteId": "root",
|
||||||
|
"title": "Hello",
|
||||||
|
"type": "image",
|
||||||
|
"mime": "image/png",
|
||||||
|
"content": ""
|
||||||
|
}
|
||||||
|
|
||||||
|
> {% client.global.set("createdNoteId", response.body.note.noteId); %}
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
PUT {{triliumHost}}/etapi/notes/{{createdNoteId}}/content
|
||||||
|
Authorization: {{authToken}}
|
||||||
|
Content-Type: application/octet-stream
|
||||||
|
Content-Transfer-Encoding: binary
|
||||||
|
|
||||||
|
< ../images/icon-color.png
|
||||||
|
|
||||||
|
> {% client.assert(response.status === 204); %}
|
||||||
|
|
|
@ -20,6 +20,8 @@ Content-Type: text/plain
|
||||||
|
|
||||||
Changed content
|
Changed content
|
||||||
|
|
||||||
|
> {% client.assert(response.status === 200); %}
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
GET {{triliumHost}}/etapi/notes/{{createdNoteId}}/content
|
GET {{triliumHost}}/etapi/notes/{{createdNoteId}}/content
|
||||||
|
|
Loading…
Reference in a new issue