added http verb to php curlopt conversion function

This commit is contained in:
Shruti Roy
2024-03-17 23:21:39 +05:30
parent 41ae457510
commit 1c288bc7c2

View File

@ -6,4 +6,23 @@ import 'package:apidash/models/models.dart' show RequestModel;
import 'package:apidash/consts.dart';
class PHPcURLCodeGen {
//function for http verb to curl mapping
String httpMethod(String methodName) {
switch (methodName) {
case "POST":
return "CURLOPT_POST";
case "GET":
return "CURLOPT_HTTPGET";
case "PUT":
return "CURLOPT_PUT";
case "DELETE":
return "CURLOPT_CUSTOMREQUEST";
case "PATCH":
return "CURLOPT_CUSTOMREQUEST";
case "HEAD":
return "CURLOPT_NOBODY";
default:
return "";
}
}
}