We often come across scenarios where we need to deal with files as a part of the payload of an HTTP request or as a response. Though it is easy to do it manually in postman or swagger, it is a challenge when it comes to automation. In this article, let’s see how to automate such api endpoints by sending files as a part of requests and how to download if a response is also a file.
Attach File to Request
Scalaj-HTTP is a wrapper for an HTTP client in Scala. It provides a method — postMulti to attach files as a part of a request.