I am running into an interesting anomaly with one particular call from typescript. All other’s work fine.
Error:
Access to fetch at ‘https://localhost:8443/json/reply/Object’ from origin ‘http://localhost:4205’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
Config:
Plugins.Add(new CorsFeature(allowedOrigins: "http://localhost:4205",
allowedMethods: "GET, POST, PUT, DELETE, OPTIONS,PATCH",
allowedHeaders: "Content-Type,enctype,filename,Authorization",
allowCredentials: true));
DTO:
[Route("/shipping","POST")]
public class shippingCostSchedule : IReturn<shippingCostSchedule>
{
public decimal to_price_1 { get; set; }
public decimal to_price_2 { get; set; }
public decimal shipping_cost_1 { get; set; }
public decimal shipping_cost_2 { get; set; }
public decimal shipping_cost_3 { get; set; }
}
TS Code:
changeShippingCost()
{
var client = new JsonServiceClient(this.baseUrl);
client.bearerToken = this.bearerToken;
try {
const response = client.post(this.shippingCost);
response.then(data=> ...