Have created a DevTest virtual service based on Swagger.
Need to respond back with different response code based on an encrypted field. Doing decryption and matching in VSM and populating different response codes and description.
When trying to set the VSI response meta with these fields, implementation is failing for at http respond step.
• Wanting to save the HTTP-Response-Code to a DevTest property in the VSI.
• It only works if the value is hardcode (401 in this case)
• Getting error:
Message: The response object is not formed properly. It is missing the response code meta data entry or it is invalid: code=401
All supported DevTest releases.
N/A
Create a scriptable DPH with this code:
import.com.itko.util.Parameter;
import com.itko.util.ParameterList;
ParameterList metaData = new ParameterList();
//com.itko.util.ParameterList metaData = lisa_vse_response.get(0).getMetaData();
metaData.addParameter(new Parameter("HTTP-Response-Code", "401"));
metaData.addParameter(new Parameter("HTTP-Response-Code-Text", "Unauthorized"));
lisa_vse_response.get(0).setMetaData(metaData);