Virtual Endpoint with POST method

Hi, I am junior on tyk. I setup a virtual enpoint.

Method: GET
Path:
Plugins: Virtual Endpoint

Code:

function myVirtualHandler (request, session, config) {

// Batch request
var batch = {
    "requests": [
        {
            "method": "POST",
            "headers": {},
            "body": JSON.stringify({Id: 456,Name: "654"}),
            "relative_url": "http://192.168.184.198:2323/api/projects"
        }
    ],
    "suppress_parallel_execution": false
}

log("[Virtual Test] Making Upstream Batch Request")
var newBody = TykBatchRequest(JSON.stringify(batch))

var responseObject = {
Body: “THIS IS A VIRTUAL RESPONSE”,
Headers: {
“test”: “virtual”,
“test-2”: “virtual”
},
Code: 200
}

return TykJsResponse(responseObject, session.meta_data)   

}

Please help me correct my code because it dont work. And could you share with me " log("[Virtual Test] Making Upstream Batch Request") will write to.

Are you getting any useful errors in the Gateway logs?

Hi Luan,

I cant find any log in /var/log or /var/log/upstart.

I add “log(”[Virtual Test] Making Upstream Batch Request")" into virtual endpoint. Where is tyk write log.

And exception log. I dont have any experiment with tyk.

Thanks