Skip to content

fix: Flag ZClient.request as deprecated#3931

Merged
987Nabil merged 5 commits intozio:mainfrom
andresctirado:fix-deprecate-zclient-request
Mar 8, 2026
Merged

fix: Flag ZClient.request as deprecated#3931
987Nabil merged 5 commits intozio:mainfrom
andresctirado:fix-deprecate-zclient-request

Conversation

@andresctirado
Copy link
Contributor

Problem

The request method in the ZClient companion object was marked as deprecated, but the instance methods were not. This caused confusion for users who had a ZClient instance and called request directly without seeing any deprecation warning.

As noted in #3133:

If you already have an instance of ZClient, the method request is still accessible and it's not obvious that it's oriented for streaming usage.

Fixes #3133

Solution

  • Added @deprecated("Use batched or streaming instead", since = "3.0.0") annotation to both request method overloads in the ZClient class
  • Added @nowarn("msg=deprecated") to internal usages that legitimately call the deprecated method
  • Updated test files with @nowarn to maintain compilation with -Xfatal-warnings

Changes

  • zio-http/shared/src/main/scala/zio/http/ZClient.scala
  • zio-http/shared/src/main/scala/zio/http/endpoint/internal/EndpointClient.scala
  • Test files updated with suppression annotations

Testing

All existing tests compile and pass with the deprecation warnings properly suppressed.

/claim #3133

@netlify
Copy link

netlify bot commented Jan 27, 2026

Deploy Preview for zio-http ready!

Name Link
🔨 Latest commit ec87c94
🔍 Latest deploy log https://app.netlify.com/projects/zio-http/deploys/697a5bff93f6bd0008d4afef
😎 Deploy Preview https://deploy-preview-3931--zio-http.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@andresctirado andresctirado force-pushed the fix-deprecate-zclient-request branch from 8e2dfb8 to 2ce6123 Compare January 27, 2026 12:57
Fixes zio#3133

This PR marks the `request` methods in the `ZClient` class as deprecated
to align with the companion object's deprecation and guide users toward
using `batched` or `streaming` methods instead.

Changes:
- Added @deprecated annotation to both `request` method overloads in ZClient class
- Added @nowarn annotations to internal usages to suppress deprecation warnings
- Updated test files with @nowarn to maintain compilation with -Xfatal-warnings

/claim zio#3133
@andresctirado andresctirado force-pushed the fix-deprecate-zclient-request branch from 2ce6123 to 4455ea6 Compare January 27, 2026 13:14
@987Nabil 987Nabil requested a review from Copilot January 28, 2026 14:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #3133 by properly marking the ZClient.request instance methods as deprecated, ensuring users receive deprecation warnings when calling these methods on a ZClient instance.

Changes:

  • Added @deprecated annotations to both request method overloads in the ZClient class
  • Suppressed deprecation warnings in internal code and tests that legitimately use the deprecated methods
  • Imported nowarn annotation where needed

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
zio-http/shared/src/main/scala/zio/http/ZClient.scala Added deprecation annotations to instance request methods and suppressed warnings for internal usages
zio-http/shared/src/main/scala/zio/http/endpoint/internal/EndpointClient.scala Suppressed deprecation warning for legitimate internal usage
zio-http/jvm/src/test/scala/zio/http/netty/client/NettyConnectionPoolSpec.scala Suppressed deprecation warnings in test file
zio-http/jvm/src/test/scala/zio/http/netty/NettyStreamBodySpec.scala Suppressed deprecation warnings in test file
zio-http/jvm/src/test/scala/zio/http/ZClientAspectSpec.scala Suppressed deprecation warnings in test file
zio-http/jvm/src/test/scala/zio/http/RequestStreamingServerSpec.scala Suppressed deprecation warnings in test file
zio-http/jvm/src/test/scala/zio/http/ClientStreamingSpec.scala Suppressed deprecation warnings in test file
zio-http-example/src/main/scala/example/CurlLoggerExample.scala Suppressed deprecation warnings in example code
zio-http-cli/src/main/scala/zio/http/endpoint/cli/Retriever.scala Suppressed deprecation warning for internal usage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@987Nabil 987Nabil merged commit c257ece into zio:main Mar 8, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flag ZClient.request as deprecated

3 participants