I have (similar to) the following code using azure's BlockBlobClient in a react typescript app:
let containerClient = new ContainerClient(mySasTokenUri);
const blockBlobClient = containerClient.getBlockBlobClient(generatedBlobName);
await blockBlobClient.uploadData(file);
For the uploadData function, I can see the request generated, but can't see a HTTP verb in its headers.
I need to configure the CORS settings for the storage account for these request in the portal (and related Infrastructure As Code) and need to whitelist the verb.
What HTTP verb is this request using by default and how can I see it?
CodePudding user response:
That uses this operation spec in the SDK if the content fits in single block: https://github.com/Azure/azure-sdk-for-js/blob/79fdcd843de6ca13c4edabd59555461444a1532b/sdk/storage/storage-blob/src/generated/src/operations/blockBlob.ts#L201.
It uses the PUT verb. This endpoint in the Storage API: https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob.
If the content requires multiple blocks, it does a "stage block" operation (https://github.com/Azure/azure-sdk-for-js/blob/79fdcd843de6ca13c4edabd59555461444a1532b/sdk/storage/storage-blob/src/generated/src/operations/blockBlob.ts#L303) for each piece and then a "commit block list" operation (https://github.com/Azure/azure-sdk-for-js/blob/79fdcd843de6ca13c4edabd59555461444a1532b/sdk/storage/storage-blob/src/generated/src/operations/blockBlob.ts#L380). These also use the PUT verb.