Upload binary file to a virtual endpoint

Hi,
We want to setup a virtual endpoint to be able to transform a binary file (uploaded through a PUT HTTP request). But when checking the value of the body in the virtual function (where the binary is supposed to be), we get something like (see below). Where is the content of the binary file?

“{\n "id": "65ef77e1-f10c-43fa-8686-7c3d97474f3d",\n "values": [\n {\n "key": "mgmtUrl",\n "value": "http://localhost:8081",\n "enabled": true\n },\n {\n "key": "urlTyk",\n "value": "http://localhost:8081",\n "enabled": true\n }\n ],\n "name": "My Workspace Globals",\n "_postman_variable_scope": "globals"\n}”

Hi @Juan_Bernabeu,
Thanks for posting your question here. It seems that this can’t be done in the virtual endpoint(JSVM) because in JavaScript everything is a string and passing binary attachment it will get corrupted. However, you can use the Python or Golang plugins (supported since 2.9), since they operate with bytes directly to achieve this use case.

Hi! Thanks for the quick reply and the clarification. We’ll give it a try with Python