dio2curl function

String dio2curl (
  1. RequestOptions requestOption
)

Implementation

String dio2curl(RequestOptions requestOption) {
  var curl = '';



  // Add PATH + REQUEST_METHOD
  curl += 'curl --request ${requestOption.method} \'${requestOption.path}\'';

  // Include headers
  for(var key in requestOption.headers.keys) {
    curl += ' -H \'$key: ${requestOption.headers[key]}\'';
  }

  // Include data if there is data
  if(requestOption.data != null) {
    curl += ' --data-binary \'${requestOption.data}\'';
  }

  curl += ' --insecure'; //bypass https verification


  return curl;
}