[R] return API response when content is raw (not coercible to text)#20142
[R] return API response when content is raw (not coercible to text)#20142mattpollock wants to merge 1 commit intoOpenAPITools:masterfrom
Conversation
| if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { | ||
| local_var_response$content | ||
| if (is.raw(local_var_response$content)) { | ||
| return(local_var_response) | ||
| } else { | ||
| return(local_var_response$content) | ||
| } |
There was a problem hiding this comment.
@wing328 feel free to keep or discard this change. As requested I pulled this out of #20131. If declined, the result will be that when an endpoint that returns binary data (e.g., a gzipped directory) that cannot be coerced to text, the return value will be a raw vector. If accepted, the return value in this case will be an instance of ApiResponse, which is what gets returned if there are error codes too.
There was a problem hiding this comment.
Another alternative would be to return(invisible(local_var_response$content)) so that the raw vector, though returned, will not be printed in the event that it is not captured to a variable. This may be a better option since it seems likely that these sorts of endpoints will be invoked without assigning the response to a variable.
This is a new PR for a breaking change removed from #20131.
@Ramanth, @saigiridhar21, @wing328
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)