github.com/anuvu/tyk@v2.9.0-beta9-dl-apic+incompatible/middleware/testPostVirtual.js (about)

     1  function thisPostTest(request, session, config) {
     2  	// Set up a response object
     3  	var response = {
     4  		Body: "",
     5  		Headers: {
     6  			"test": "virtual-header-1", 
     7  			"test-2": "virtual-header-2",
     8  			"content-type": "application/json"
     9  		},
    10  		Code: 200
    11  	}
    12  
    13  	data_as_json = JSON.parse(request.Body)
    14  
    15  	var bod = {
    16  		inbound_array_length: data_as_json.length
    17  	}
    18  
    19  	// We need to send a string object back to Tyk to embed in the response
    20  	response.Body = JSON.stringify(bod)
    21  
    22  	return TykJsResponse(response, session.meta_data)
    23  	
    24  }
    25  log("Virtual Post test initialised")