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

datasource/http: don't error on 2xx code #12989

Merged
merged 1 commit into from
May 21, 2024
Merged

Conversation

lbajolet-hashicorp
Copy link
Contributor

When a server returns a code that is not 200, we error in the current state.

This is not conformant to the HTTP norm, as anything in the 2xx range is considered a success, so the datasource should not error in this case.

Therefore, this commit fixes the condition in which we report an error, so that anything in the 2xx range is now considered a success by the datasource.

Closes: #12987

When a server returns a code that is not 200, we error in the current
state.

This is not conformant to the HTTP norm, as anything in the 2xx range is
considered a success, so the datasource should not error in this case.

Therefore, this commit fixes the condition in which we report an error,
so that anything in the 2xx range is now considered a success by the
datasource.
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

I see this datasource only has acceptance tests. We can replace these tests with a test HTTP server that returns different response codes to validate the behavior. Maybe in a separate PR as there are some actual hcl template files that need changing and test refactored.

datasource/http/data.go Show resolved Hide resolved
@lbajolet-hashicorp lbajolet-hashicorp merged commit 5d43239 into main May 21, 2024
12 checks passed
@lbajolet-hashicorp lbajolet-hashicorp deleted the fix_http_return_2xx branch May 21, 2024 18:26
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: http data-datasource errors on 201 status code
2 participants