cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.73k stars 723 forks source link

Update local AI fetcher to forward method and pathname to upstream #7315

Closed G4brym closed 10 hours ago

G4brym commented 1 day ago

This pr starts forwarding method and url to upstream. This is not a breaking change, because the AI binding currently just does POST requests.

workerd here


changeset-bot[bot] commented 1 day ago

🦋 Changeset detected

Latest commit: 931acf718c4f0c2e447db4aae346eccf529a6b59

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ------------------------------- | ----- | | wrangler | Minor | | @cloudflare/vitest-pool-workers | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 1 day ago

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11971817665/npm-package-wrangler-7315

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7315/npm-package-wrangler-7315

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11971817665/npm-package-wrangler-7315 dev path/to/script.js
Additional artifacts: ```sh npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11971817665/npm-package-create-cloudflare-7315 --no-auto-update ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11971817665/npm-package-cloudflare-kv-asset-handler-7315 ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11971817665/npm-package-miniflare-7315 ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11971817665/npm-package-cloudflare-pages-shared-7315 ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11971817665/npm-package-cloudflare-vitest-pool-workers-7315 ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11971817665/npm-package-cloudflare-workers-editor-shared-7315 ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11971817665/npm-package-cloudflare-workers-shared-7315 ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11971817665/npm-package-cloudflare-workflows-shared-7315 ``` Note that these links will no longer work once [the GitHub Actions artifact expires](https://docs.github.com/en/organizations/managing-organization-settings/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-organization).

wrangler@3.89.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20241106.1
workerd 1.20241106.1 1.20241106.1
workerd --version 1.20241106.1 2024-11-06

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

G4brym commented 1 day ago

@petebacondarwin sure, let me add a test and get back to you Regarding the header name, i don't think "X-Forwarded-Host" fits well, because we are forwarding the complete url, not just the hostname, i guess nothing stops us from doing it anyway, it might just be confusing for someone new The part we are really interested is in the utl pathname + querystring, so i thought i might as well send the complete url

G4brym commented 1 day ago

Hey @petebacondarwin I've just updated the pr with new tests and new header name Please take a look when you have time, thanks

petebacondarwin commented 10 hours ago

Still LGTM!