What about the Curl output? I suggest using:
curl -v -X POST \
http://localhost/test \
-H 'Authorization: Bearer abcd' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F type=test \
-F document=@/tmp/example.jpg
It would be useful to see the headers that are sent.