Logos DX
    Preparing search index...

    Function requestSerializer

    • Request serializer for generating deduplication and cache keys.

      Serializes by request identity: method + URL path+search + payload + stable headers. Used for policies that identify duplicate requests.

      Only includes stable, semantically-meaningful headers (Authorization, Accept, Accept-Language, Content-Type, Accept-Encoding). Dynamic headers like timestamps, HMAC signatures, and request IDs are excluded to prevent cache pollution.

      Header lookup is case-insensitive (keys are lowercased for comparison).

      Uses url.pathname + url.search which:

      • Includes the full path and query parameters
      • Excludes the hash fragment (which shouldn't affect request identity)
      • Excludes the origin (handled by FetchEngine instance)

      Parameters

      Returns string

      A unique string key for the request

      requestSerializer({
      method: 'GET',
      path: '/users/123',
      url: new URL('https://api.example.com/users/123?page=1'),
      payload: undefined,
      headers: {
      'Authorization': 'Bearer token',
      'X-Timestamp': '1234567890', // Ignored (dynamic)
      'Accept': 'application/json'
      }
      });
      // Returns: 'GET|/users/123?page=1|undefined|{"accept":"application/json","authorization":"Bearer token"}'