fix(task) #35 #36 #37 #38 #39 RequestTask and Client fixes, #31 add missing tests - #40
Merged
Merged
Conversation
1 of 3 tasks
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.
Description
Fixes #31.
Fixes #35.
Fixes #36.
Fixes #37.
Fixes #38.
Fixes #39.
Grouped in one PR because the fixes change the same task, client, tests, reference pages and the CHANGELOG
Latestsection.RequestTask
getContent(false): a3xx/4xx/5xxcode listed invalid_response_codenow outputs the response body (getContent()threw, thecatchonly skipped the log). The then useless exception filtering of thecatchis removed: every failure is logged.getResponseDetails(), which returns nothing after a transport error (reading them threw again inside thecatch: the log was lost).log_responselogs the requested URL (merged with the input) andstatus_code,headers,contentinstead of the configuredurland the response object.RequestTask expects an array or empty input, <type> given(TypeErrorfromarray_merge()).Client
inttriggered aTypeErrorfromrawurlencode()), a non-scalar one throws an\UnexpectedValueException.getUri()added,geUri()deprecated (PHPDoc only, it still works) inClientandClientInterface: addinggetUri()to the interface would break the custom clients, it is left for the next major version.MissingClientException::create(string $code): self.Tests (#31)
RequestTaskTest: body output, input overriding the options,3xx/4xx/5xxcodes declared valid, invalid code withskip/stop(error output, log with headers and body), transport error and error while reading the content (logged),log_response, non-array input, missing client.ClientTest: accessors (getUri()/geUri()), GET with query string and encoded scalar URL parameters, JSON POST, raw body and custom headers, invalid method, invalid URL parameters, unknown option, request failure.MissingClientExceptionTest,CleverAgeRestProcessExtensionTest,CleverAgeRestProcessBundleTest(new).25 tests, 187/195 lines. The remaining lines are
ClientRegistryand the compiler pass of the bundle, whose tests come with #34 (left out here to avoid conflicting files). Without the fix, 15 of the new tests fail.Documentation:
request_task.md(inputs, output,url_parameters,log_response, notes on valid codes and transport errors),client.md(URL parameters,geUri()deprecation,getApiUrl()).Checked with process-bundle-demo (see the demo PR):
demo.rest.valid_client_error(400declared valid)HTTP/2 400 returned for ...demo.rest.transport_errorREST request failedlogCould not resolve hostdemo.rest.log_response(-vvv, url from the input)Response received from '/configured/url',resultobjectResponse received from '/codes-postaux/communes/46800', status code / headers / contentdemo.rest.url_parameter_intrawurlencode(): Argument #1 ($string) must be of type string, int givendemo.rest.invalid_inputarray_merge(): Argument #2 must be of type array, string givenRequestTask expects an array or empty input, string givendemo.rest.getThis PR and #34 both add entries to the CHANGELOG
Latestsection: the one merged second needs a rebase.Requirements
Breaking changes
3xx/4xx/5xxstatus code listed invalid_response_codenow outputs the response body (the task failed).Response receiveddebug log changes (resultreplaced bystatus_code,headers,content).geUri()is deprecated; a class extendingMissingClientExceptionand overridingcreate()must declare the same types.🤖 Generated with Claude Code