Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for custom API requests #246

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

yurique
Copy link
Collaborator

@yurique yurique commented Oct 9, 2023

Adding two helper methods in the client:

  • def customRequest(request: Request[F]): F[Request[F]] and
  • def customRequest(request: WSRequest): F[WSRequest]

These methods update the provided request by setting the API hostname and adding the authorization.

This should help us more easily use other k8s API endpoints that are not explicitly supported by this library.

(Not having these, I had to do some "hacking" in order to use the logs endpoint in our code, like defining an object inside the com.goyeau.kubernetes.client package in order to get access to .withOptionalAuthorization and some other things).

headers = request.headers,
body = request.body,
attributes = request.attributes
).withOptionalAuthorization(authorization)
Copy link
Owner

Choose a reason for hiding this comment

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

Why not using a copy here like below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

http4s' Request is a final class (not case class) thus it doesn't provide the .copy methods unfortunately.

@joan38 joan38 merged commit 6c8d543 into joan38:main Nov 1, 2023
7 checks passed
@yurique yurique mentioned this pull request Nov 24, 2023
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.

2 participants