You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating new entity in client side blazor app with Microsoft.ODataClient I get an exception stating that response to this POST request is missing Location header. When I run fiddle to see what's going on I can see that it actually made 2 requests. First one was CORS preflight request with OPTIONS method. Response to this request does not contain Location header. Second request is the actual POST request and response contains correct location header.
Any idea how to deal with this problem?
Assemblies affected
Microsoft.OData.Client 7.6.4
Reproduce steps
var dataServiceContext = this.ClientFactory.CreateClient<Container>(new Uri("http://localhost:5000/odata"));
var newAsset = new CreateAssetDto()
{
TechnicalName = "from_client_4",
DisplayNameFormat = "format from client",
Icon = "client/icon",
InheritedFrom = Guid.NewGuid(),
IsActive = true,
Translation = new AssetTranslationDto
{
Title = "Client Asset",
Language = "en",
Description = "This is asset from client"
}
};
dataServiceContext.AddToAssets(newAsset);
await dataServiceContext.SaveChangesAsync();
Expected result
No exception complaining about location header missing.
Actual result
Exception complaining about location header missing.
The text was updated successfully, but these errors were encountered:
I have modified our server side to include the location header in responses for all OPTIONS requests. When I inspect traffic with fiddler again both requests now contain location header but the exception is thrown anyway. That is really strange...
One thing I don't understand is that in Fiddler the location header I added is not highlighted and the second one is. See the attached image. I'm adding the header like this: context.Response.Headers["Location"] = context.Request.GetEncodedUrl();
I have the same issue but in console app. When I call "SaveChanges" after "AddToMyTable", it throws The response to this POST request did not contain a 'location' header. That is not supported, but data has been created into database
When creating new entity in client side blazor app with Microsoft.ODataClient I get an exception stating that response to this POST request is missing Location header. When I run fiddle to see what's going on I can see that it actually made 2 requests. First one was CORS preflight request with OPTIONS method. Response to this request does not contain Location header. Second request is the actual POST request and response contains correct location header.
Any idea how to deal with this problem?
Assemblies affected
Microsoft.OData.Client 7.6.4
Reproduce steps
Expected result
No exception complaining about location header missing.
Actual result
Exception complaining about location header missing.
The text was updated successfully, but these errors were encountered: