--
You received this message because you are subscribed to the Google Groups "ServiceStack .NET Open Source REST Web Services Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to servicestack...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "ServiceStack .NET Open Source REST Web Services Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to servicestack...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
this.RequestFilters.Add((httpReq, httpRes, requestDto) => {
//Handles Request and closes Responses after emitting global HTTP Headers
if (httpReq.Method == "OPTIONS")
httpRes.EndServiceStackRequest();
});I corrected like that . (I hope didn't make mistake)using ServiceStack.WebHost.Endpoints.Extensions;
--
You received this message because you are subscribed to the Google Groups "ServiceStack .NET Open Source REST Web Services Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to servicestack...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
At the beginning, the code could not compile, because it could not find the EndServiceStackRequest().
It is confusing because we don't know that it is an extension method. ( not only me, we expected a class method)
As you said in the namespace ServiceStack.WebHost.Endpoints.Extensions.
A reference to System.Web also required. Also the httpReq.Method is httpReq.HttpMethod.
The most important is the declaration in Routes for OPTIONS.
Fortunately, it is not necessary to add an empty method 'Options(RequestDto)`.
using System.Web;
using ServiceStack.WebHost.Endpoints.Extensions;
Plugins.Add(new CorsFeature());
this.RequestFilters.Add((httpReq, httpRes, requestDto) =>
{
//Handles Request and closes Responses after emitting global HTTP Headers
if (httpReq.HttpMethod == "OPTIONS")
httpRes.EndServiceStackRequest();
});
Routes
.Add<ReservationRequest>("/TestAPI/CreateReservation", "POST, OPTIONS")