Could someone please tell me how i can test this function :
[RoutePrefix("service")]
public class TestControler : ApiController
{
[Route("function-route")]
[HttpPost]
public HttpResponseMessage Testfunction(TestData t_testData )
{
...
HttpResponseMessage httpResponseMessage = Request.CreateResponse(HttpStatusCode.OK);
return httpResponseMessage;
}
}
public class TestData
{
public byte[] PreviewImage { get; set; }
public byte[] FileAsByteArray { get; set; }
}
We have Swagger enabled via :
public void Configuration(IAppBuilder appBuilder)
{
// Configure Web API for self-host.
HttpConfiguration config = new HttpConfiguration();
//Using AttributeRoutes
config.MapHttpAttributeRoutes();
//Swagger
config.EnableSwagger(c =>{
c.SingleApiVersion("v1", "My Test API");
}).EnableSwaggerUi();
appBuilder.UseWebApi(config);
}
I really do not know how to test this API via swagger, or postman, or curl. The problem ist the byte[], how to send this? Does anyone how to test these kind of api?
Or, if there is another way to send any file (pdf, txt, docx, ...) combined with any picture (jpg, png, ...) without byte[], i would be glad to hear.