Prepare client for HTTP 202: accept all 2xx status codes in check_for_status#206
Merged
Merged
Conversation
Agent-Logs-Url: https://github.com/FlexMeasures/flexmeasures-client/sessions/fc24eb27-c607-47e2-8d1d-916f5f26ceaa Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
Flix6x
May 14, 2026 06:58
View session
Coverage Report for CI Build 25846640800Coverage increased (+0.02%) to 96.27%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Member
|
This PR makes the client accept 202, but does not yet update any expectation about it. That means that when the client starts to receive a 202 when forecasts/schedules are triggered, it still expects a 200, but will continue fine and just log an info statement. As soon as we know the FM version that moves from 200 to 202 for certain endpoints, we can update the client's expectations in accordance with the server version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When FlexMeasures server switches from returning
200to202 Acceptedon certain endpoints, the client would raise aValueError.check_for_statusonly accepted an exact status match, making the client fragile against server version differences.Changes
response_handling.py:check_for_statusnow accepts any 2xx status (200–299). Logs atINFOwhen the actual status differs from the expected one; raisesValueErrorfor non-2xx codes unchanged.tests/client/test_init.py: Added parametrized test cases covering exact-match success (no log), alternate 2xx success with INFO log, all common 2xx codes, and non-2xx boundary values (199,300,400,404,500,503).