# putFile POST request sends an empty body

**URL:** <https://forum.collaboraonline.com/t/putfile-post-request-sends-an-empty-body/337>\
**Category:** Installation & Configuration\
**Created:** [May 2, 2021, 7:56am UTC](https://forum.collaboraonline.com/t/putfile-post-request-sends-an-empty-body/337 "2021-05-02T07:56:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mshadi](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@mshadi](https://forum.collaboraonline.com/u/mshadi)\
**Post date:** [May 2, 2021, 7:56am UTC](https://forum.collaboraonline.com/t/putfile-post-request-sends-an-empty-body/337/1 "2021-05-02T07:56:20Z")

</div>

I have implemented discovery, getFileInfo, getFile and putFile in my own WOPI host. All are working fine except putFile.  
When I change my document it is routed to my putFile function, but the body which is expected to have the file content, is empty!

Can anybody help why that happened?

```
 route('POST', '/wopi/files/:fileId/contents', (req, res) => {
    console.log(' *********putFile routed*********')
    if (req.body) {
      console.dir( req.body)
      res.sendStatus(200);
    } else {
      console.log('Not possible to get the file content.');
      res.sendStatus(404);
    }
  });
```

---

<div class="post-metadata">

**Author:** ![mmeeks](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/mmeeks/32/371_2.png) [@mmeeks](https://forum.collaboraonline.com/u/mmeeks)\
**Post date:** [May 4, 2021, 3:25pm UTC](https://forum.collaboraonline.com/t/putfile-post-request-sends-an-empty-body/337/2 "2021-05-04T15:25:35Z")

</div>

If you turn debugging up to ‘trace’ - what do the logs say about posting the file on save ? =) there is very verbose loolwsd.log logging indeed if you turn it to maximum.

---

<div class="post-metadata">

**Author:** ![mshadi](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@mshadi](https://forum.collaboraonline.com/u/mshadi)\
**Post date:** [May 5, 2021, 8:47am UTC](https://forum.collaboraonline.com/t/putfile-post-request-sends-an-empty-body/337/3 "2021-05-05T08:47:59Z")

</div>

Thank you for your reply.

I checked the loggs, It says that it successfully upload the file contents. the logs are exactly the same as logs produced via [example project](https://github.com/CollaboraOnline/collabora-online-sdk-examples//tree/master/webapp/reactjs) which its putFile has content in its body.

 ![Screenshot from 2021-05-05 10-29-16](https://europe1.discourse-cdn.com/flex013/uploads/collaboraonline/original/1X/2a173fd7029234af383e40e7347795656a03ae65.png)

So should I do something in my project to make it work?

---

<div class="post-metadata">

**Author:** ![mshadi](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@mshadi](https://forum.collaboraonline.com/u/mshadi)\
**Post date:** [May 8, 2021, 9:54am UTC](https://forum.collaboraonline.com/t/putfile-post-request-sends-an-empty-body/337/4 "2021-05-08T09:54:58Z")

</div>

Actually the problem solved, it was about using [body-parser](https://www.npmjs.com/package/body-parser) in my wopi host code.

Thanks.
