admin管理员组文章数量:1123106
I have a restful API post
function build in C# on the ASP.NET framework that expects a request body object with one major parameter being of type byte[]
. The service is designed to take a file's byte array, and process it.
I am testing it using postman. Because it requires a byte[]
providing it through postman seems very cumbersome. I need to get the byte array, then convert that byte array to a numeric array and pass that whole string into the raw JSON object.
In my small test file this is a 9000 record integer array. I assume it gets worse the bigger the file gets. In addition, getting this array as string required setting up a debug session and writing some code to get the int array string out. It doesn't feel right or efficient.
I attempted to solve this by executing the post call with form-data (multipart/form-data
) so I could have a field of type file, as well as fields for the other values, but this also presented problems, namely, the service couldn't execute with multipart/form-data
. I have many services that pass in byte[]
so I know it works, but is there any alternatives that make the process easier to test?
本文标签: cAlternative to using byte in restful API function to ease testing using postmanStack Overflow
版权声明:本文标题:c# - Alternative to using byte[] in restful API function to ease testing using postman? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736546243a1944450.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论