http method options

This commit is contained in:
Rio Jos
2025-04-24 13:05:00 +05:30
parent b65d23337b
commit aa8e5c3d03
5 changed files with 19 additions and 2 deletions

View File

@ -11,7 +11,10 @@ A List of API endpoints that can be used for testing API Dash
#### For Testing HTTP PUT, PATCH, DELETE
- https://reqres.in/
#### For Testing HTTP OPTIONS, TRACE
- Use localhost servers, as TRACE and OPTIONS HTTP methods are not publicly available (used for diagnostic purposes)
#### For Testing sites with Bad Certificate
- https://badssl.com/
- https://www.ssl.com/sample-valid-revoked-and-expired-ssl-tls-certificates/

View File

@ -51,6 +51,7 @@ Color getHTTPMethodColor(HTTPVerb? method) {
HTTPVerb.put => kColorHttpMethodPut,
HTTPVerb.patch => kColorHttpMethodPatch,
HTTPVerb.delete => kColorHttpMethodDelete,
HTTPVerb.options => kColorHttpMethodOptions,
_ => kColorHttpMethodGet,
};
return col;

View File

@ -17,7 +17,8 @@ enum HTTPVerb {
post("POST"),
put("PUT"),
patch("PAT"),
delete("DEL");
delete("DEL"),
options("OPT");
const HTTPVerb(this.abbr);
final String abbr;

View File

@ -104,6 +104,17 @@ Future<(HttpResponse?, Duration?, String?)> sendHttpRequest(
final streamed = await client.send(request);
response = await http.Response.fromStream(streamed);
break;
case HTTPVerb.options:
final request = prepareHttpRequest(
url: requestUrl,
method: requestModel.method.name.toUpperCase(),
headers: headers,
body: body,
overrideContentType: overrideContentType,
);
final streamed = await client.send(request);
response = await http.Response.fromStream(streamed);
break;
}
}
if (apiType == APIType.graphql) {

View File

@ -23,6 +23,7 @@ final kColorHttpMethodPost = Colors.blue.shade800;
final kColorHttpMethodPut = Colors.amber.shade900;
final kColorHttpMethodPatch = kColorHttpMethodPut;
final kColorHttpMethodDelete = Colors.red.shade800;
final kColorHttpMethodOptions = Colors.yellow.shade800;
final kColorGQL = Colors.pink.shade600;