2

Is there any possibility to transfer files in request body? Without conversion to base64 or make file a part of JSON parameter? Simply REST request body with file

  • 1
    It depends on the contents of your file. It may work for ASCII text (still a risk, though), but binary files need to be encoded because they can contain values/bytes that not allowed by the protocol. – GolezTrol Mar 10 '19 at 01:42
  • Apart from that, I'm not really sure where this question comes from, why you want to do it. Is it because [DataSnap demands Json?](https://stackoverflow.com/questions/18110654/upload-file-to-datasnap-rest-server-via-tstream) – GolezTrol Mar 10 '19 at 01:44
  • The counter question of course is: Why do you want to use DataSnap for simply sending files, why not just `TIdHTTP.Post`? – GolezTrol Mar 10 '19 at 01:45
  • @GolezTrol this would require additional separation of incoming requests on the server side, using a separate port / a separate framework. If DataSnap supports binary paylods, it would be much easier. (and this is still a valid RESTful WebService, using standard HTTP) – mjn Mar 10 '19 at 17:22

0 Answers0