Skip to content

feat: custom headers in PostEndpoint createRequest

Cindy Halim requested to merge 348-allow-request-specific-headers into main

Issue: [Refactor] Allow request specific headers in Ap... (#348 - closed)

Description

ApiRequest already accepts custom headers (see here). This MR extends allows passing request specific headers to createRequest built with the PostBuilder .

Demo

Description How to validate locally Screenshot

We can pass request specific headers in PostEndpoint.createRequest

  • Apply the following patch
  • Open Web IDE
  • Observe request to /extensions in network tab
Patch
diff --git a/packages/web-ide/src/cleanExtensions.ts b/packages/web-ide/src/cleanExtensions.ts
index cb16bbf..13850df 100644
--- a/packages/web-ide/src/cleanExtensions.ts
+++ b/packages/web-ide/src/cleanExtensions.ts
@@ -93,6 +93,8 @@ export const cleanWebIdeExtensions = async (config: WebIdeConfig) => {
   const shouldUseCrossOriginExtensionHost = config.featureFlags?.crossOriginExtensionHost;
   const canUseLocalStorage = storageAvailable('localStorage');
 
+  await removeSettingsSyncExtensions(config);
+
   // If we're using extension marketplace, then save it off and there's nothing to do
   if (isExtensionMarketplaceEnabled) {
     if (canUseLocalStorage) {

with_custom_header.png

Existing requests using PostEndpoint with no custom headers should still work

  • We can use postProjectCommit as an example
  • Open Web IDE
  • Make a change and commit the change
  • Observe request to /commits in network tab

no_custom_header.png

Edited by Cindy Halim

Merge request reports

Loading