Skip to content

Add fastly.decompressGzip option for automatic decompression #81

Description

@trieloff

Background

Per adobe/helix-deploy-plugin-edge#77 and comment, @adobe/fetch should support the fastly: { decompressGzip: true } option to align Fastly and Cloudflare's fetch behavior.

Proposal

Add support for the Fastly-specific decompressGzip option within a fastly options object:

import { fetch } from '@adobe/fetch';

const response = await fetch(url, {
  fastly: {
    decompressGzip: true
  }
});

Behavior

  • Fastly: Pass through to native fastly.decompressGzip option
  • Cloudflare: No-op (Cloudflare automatically handles decompression)
  • Node.js: Map to existing compress/decode options

Context

Cloudflare Workers automatically decompress gzip responses. Fastly requires explicit opt-in via decompressGzip. Supporting this option in @adobe/fetch allows writing portable code that works identically across platforms.

Implementation Notes

Since @adobe/fetch already handles compression transparently via the compress and decode options (defaults to true), this would primarily be:

  1. Accept fastly.decompressGzip in options
  2. Map to platform-appropriate behavior
  3. Document as the cross-platform way to control decompression

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions