Add support for more HTTP methods
Extended the switch expression in `InvokeRecActionCommand.cs` to handle additional HTTP methods: "PATCH", "HEAD", "OPTIONS", and "TRACE". Implemented the appropriate asynchronous HTTP requests using `HttpClient`. "PATCH" uses `http.PatchAsync`, while "HEAD", "OPTIONS", and "TRACE" use `http.SendAsync` with a new `HttpRequestMessage`. A `BadRequestException` is thrown for unsupported methods.
This commit is contained in:
parent
c16d58788a
commit
904448ca45
@ -31,6 +31,10 @@ public class InvokeRecActionCommandHandler(ISender sender) : IRequestHandler<Inv
|
||||
"POST" => await http.PostAsync(action.EndpointUri, null, cancel),
|
||||
"PUT" => await http.PutAsync(action.EndpointUri, null, cancel),
|
||||
"DELETE" => await http.DeleteAsync(action.EndpointUri, cancel),
|
||||
"PATCH" => await http.PatchAsync(action.EndpointUri, null, cancel),
|
||||
"HEAD" => await http.SendAsync(new HttpRequestMessage(HttpMethod.Head, action.EndpointUri), cancel),
|
||||
"OPTIONS" => await http.SendAsync(new HttpRequestMessage(HttpMethod.Options, action.EndpointUri), cancel),
|
||||
"TRACE" => await http.SendAsync(new HttpRequestMessage(HttpMethod.Trace, action.EndpointUri), cancel),
|
||||
_ => throw new BadRequestException($"The REST type {action.RestType} is not supported.")
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user