Skip to content

services module: re-enable bookmarks response validation once new ResponseOperator is available #5157

Description

@odinr

Context

In BookmarksProvider.createBookmarksClient (packages/modules/services/src/provider.ts), the response-validation operator for the bookmarks HTTP client is currently commented out:

public async createBookmarksClient<TMethod extends keyof ClientMethod>(
  method: TMethod,
): Promise<BookmarksApiClient<TMethod, TClient>> {
  const httpClient = await this._createClientFn('bookmarks');
  // TODO: update when new ResponseOperator is available
  // will fail because 'HEAD' will return 404 when no bookmarks are found
  // httpClient.responseHandler.add('validate_api_request', validateResponse);
  return new BookmarksApiClient(httpClient, method);
}

It was disabled because the current validateResponse operator treats a 404 response to a HEAD request (used to check bookmark existence) as an error, even though a 404 here is an expected/valid outcome.

Task

  • Update or replace the response operator so it can distinguish an expected 404 on HEAD requests from an actual error.
  • Re-enable httpClient.responseHandler.add('validate_api_request', validateResponse) once the operator supports this case.

File

packages/modules/services/src/provider.ts (line ~160)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions