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

Add support for multiple HTTP methods, assertions, and request body in controller #58

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

abezard-conduit
Copy link

@abezard-conduit abezard-conduit commented Dec 17, 2024

Issue ref.: #54

Description:
This PR extends the controller to support more than just the GET HTTP method. Key changes include:

  • Adding logic to handle assertions, body, and bodyType for HTTP requests.
  • Default behavior ensures compatibility with existing use cases.

Work In Progress
I believe the success parameter should be fully replaced by assertions. For example, the default assertion could check that statusCode == 200. However, I am uncertain how assertions would integrate with annotations, and further discussion might be required.

Why This PR?
While the broader changes are not yet finalized, this PR solves the immediate need on our end. I figured I would share it.

{
Source: checkly.StatusCode,
Comparison: checkly.Equals,
Target: "200",
Copy link

Choose a reason for hiding this comment

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

I would change this to apiCheck.SuccessCode, and revert its removal for backwards compat reasons. It should be marked deprecated though.

Copy link

Choose a reason for hiding this comment

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

If that is done, then shouldFail should also be updated.

@@ -26,10 +26,14 @@ Any `metadata.labels` specified will be transformed into tags, for example `envi
|--------------|-----------|------------|
| `endpoint` | String; Endpoint to run the check against | none (*required) |
| `success` | String; The expected success code | none (*required) |
Copy link

@sorccu sorccu Dec 17, 2024

Choose a reason for hiding this comment

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

I believe this would no longer be required. However it should be kept for B/C and marked deprecated.

@sorccu
Copy link

sorccu commented Dec 17, 2024

This looks very cool, I added a few comments and hopefully @akosveres is able to provide his opinion.

Note that my comments are mostly about preserving backwards compatibility. We can mark things deprecated or potentially even hide them, but I do not want to outright break existing setups. If we tend to break things, people may choose to not update until absolutely necessary, which creates support issues for us in the long term.

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