1

I am using CosmosDB with Blazor WebAssembly (client side).

I have noticed one thing, every time there are two same request occur for data. I have attached that extra request detail image. I want to stop that extra request [Request Method : Option]

Capture of request detail

Code Sample :

// Get credential token
Credential Credentials = await Http.GetFromJsonAsync<CosmosCredentials>("api/Cosmos/GetCred?permissionId=" + MemberOfOrganization.PermissionId);

CosmosClientOptions clientOptions = new CosmosClientOptions()
{
   ConnectionMode = ConnectionMode.Gateway,
   ApplicationPreferredRegions = new List<string>() { Regions.JapanEast } // Specified explicitly because automatic is not working, improve later
};

client = new CosmosClient(Credentials.EndPoint, Credentials.ResourceToken, clientOptions);
orgContainer = client.GetContainer(databaseName, containerName);

// Request for cosmos document
OrganizationMonthlyInfo organizationMonthlyInfo = await orgContainer.ReadItemAsync<OrganizationMonthlyInfo>(id, new PartitionKey(partitionKey));
David Makogon
  • 64,809
  • 21
  • 130
  • 175
Umang
  • 41
  • 5
  • 2
    The OPTION request are send by the browser to check CORS settings. You can find more info at MDN https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS – Zsolt Bendes Jul 17 '20 at 18:12

0 Answers0