Skip to content

Commit

Permalink
✨ NEW: remove Content-Encoding in response of a proxied handle (#766)
Browse files Browse the repository at this point in the history
* Update dependency remult to v0.27.21

* Update dependency typescript-eslint to v8.12.2

* Update dependency @types/node to v22

* ✨ NEW: remove Content-Encoding in response of a proxied handle

* bump node LTS 22.11.00

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
jycouet and renovate[bot] authored Nov 3, 2024
1 parent b4c0405 commit 0b14bc8
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 141 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-beers-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kitql/handles': patch
---

rmv Content-Encoding in response of a proxied handle
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: jycouet/jycouet/shared-config/setup@main
with:
pnpmVersion: 9
nodeVersion: 22.6.0
nodeVersion: 22.11.0

# - name: 🛠️ Prepare nx 1/2
# uses: nrwl/nx-set-shas@v4
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
# uses: jycouet/jycouet/shared-config/setup@main
# with:
# pnpmVersion: 9
# nodeVersion: 22.6.0
# nodeVersion: 22.11.0

# - name: 🚧 Run nx build
# run: pnpm build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
name: setup env
with:
pnpmVersion: 9
nodeVersion: 22.6.0
nodeVersion: 22.11.0

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"prettier": "3.3.3",
"prettier-plugin-svelte": "3.2.6",
"prettier-plugin-tailwindcss": "0.6.6",
"typescript-eslint": "8.11.0"
"typescript-eslint": "8.12.2"
},
"publishConfig": {
"access": "public"
Expand Down
16 changes: 14 additions & 2 deletions packages/handles/src/lib/hooks/handle-proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ProxyOptions {
*
* If the fetch fails, the error is logged and rethrown.
*/
function fetchMaybeProxiedRequest(
async function fetchMaybeProxiedRequest(
fetch: RequestEvent['fetch'],
request: Request,
proxiedUrl?: string,
Expand All @@ -29,7 +29,7 @@ function fetchMaybeProxiedRequest(
if (proxiedUrl != null) {
requestHeaders.set('host', new URL(proxiedUrl).hostname)
}
return fetch(url, {
const response = await fetch(url, {
body: request.body,
method: request.method,
headers: requestHeaders,
Expand All @@ -42,6 +42,18 @@ function fetchMaybeProxiedRequest(
log.error('handleProxies ERROR')
throw err
})

// Create a new response with modified headers
const newHeaders = new Headers(response.headers)

// Remove the Content-Encoding header to prevent decoding issues
newHeaders.delete('Content-Encoding')

return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
})
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin-stripper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@sveltejs/vite-plugin-svelte": "4.0.0",
"oslo": "1.2.1",
"publint": "0.2.4",
"remult": "0.27.20",
"remult": "0.27.21",
"svelte": "5.1.3",
"svelte-check": "4.0.5",
"tslib": "2.8.0",
Expand Down
266 changes: 133 additions & 133 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"devDependencies": {
"@theguild/algolia": "2.1.0",
"@theguild/tailwind-config": "0.5.0",
"@types/node": "20.17.1",
"@types/node": "22.8.7",
"@types/react": "18.3.3",
"tailwindcss": "3.4.1"
}
Expand Down

0 comments on commit 0b14bc8

Please sign in to comment.