Skip to content

fix: restore protected visibility for HTTP methods in ClobClient#52

Open
0xZoomEye wants to merge 1 commit intoPolymarket:mainfrom
0xZoomEye:main
Open

fix: restore protected visibility for HTTP methods in ClobClient#52
0xZoomEye wants to merge 1 commit intoPolymarket:mainfrom
0xZoomEye:main

Conversation

@0xZoomEye
Copy link
Copy Markdown

@0xZoomEye 0xZoomEye commented Apr 30, 2026

Problem

In the migration to @polymarket/clob-client-v2, the low-level HTTP methods (get, post, put, delete, etc.) in src/client.ts were changed from protected to private.

While making internals more encapsulated is generally positive, this specific change removes the ability for users to subclass ClobClient and customize request behavior. This is a regression in extensibility.

Use Cases Affected

  • Injecting custom HTTP agents (proxies, keep-alive settings, mTLS, etc.)
  • Adding request/response interceptors for logging, metrics, retry logic, or tracing (e.g. OpenTelemetry)
  • Mocking the HTTP layer for better unit/integration tests
  • Implementing enterprise requirements such as custom headers, rate limiting, service mesh integration, or additional authentication schemes
  • Wrapping the client with monitoring or debugging layers without forking the entire SDK

These patterns are common and were explicitly supported in the previous version of the client.

Proposed Solution

Change the visibility of the core HTTP methods back to protected (or provide a cleaner extension point such as a configurable fetch implementation or request hooks).

This is a minimal, non-breaking change that restores the previous extensibility while preserving the other improvements introduced in v2.

Why This Matters

Libraries intended for broad adoption should favor "open for extension". Restricting core transport methods to private makes the SDK harder to adapt to real-world production and testing needs without resorting to ugly workarounds (monkey-patching, forking, etc.).

Looking forward to your feedback — happy to adjust the approach if there's a preferred direction for v2+.


Note

Low Risk
Low risk API-surface change that only relaxes method visibility; behavior is unchanged but could affect typing/override expectations for downstream subclasses.

Overview
Restores extensibility of ClobClient by changing the low-level HTTP wrapper methods get, post, and del from private to protected, allowing consumers to subclass and override request behavior without forking.

Reviewed by Cursor Bugbot for commit ef77dcd. Bugbot is set up for automated code reviews on this repo. Configure here.

@0xZoomEye 0xZoomEye requested a review from a team as a code owner April 30, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant