I'm using Moya and need to print the cURL for a network request.
Usually, in Alamofire 4, I would do something like this:
let req = Alamofire.request(someURLRequestConvertible)
debugPrint(req) // will print cURL
My call site for Moya looks like this:
MyMoyaProvider.request(MyEndPoints.login(params)) { (result) in }
I've checked out the documentation for Moya, but I can't seem to get the results I'm looking for. I enabled the NetworkLoggingPlugin
but still unsure how to print cURL
for certain requests. Can someone help me find the proper way to print the Moya request
's cURL
to console?
If you initialize your NetworkLoggerPlugin
, its cURL
flag is set to false
by default. Initializing it like NetworkLoggerPlugin(cURL: true)
, willSendRequest
should print the cURL
.
As per @BasThomas on GitHub: https://github.com/Moya/Moya/issues/1037#event-1027530791