-
Notifications
You must be signed in to change notification settings - Fork 2k
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 RequestOptions & handling in RestProxy #22334
Add RequestOptions & handling in RestProxy #22334
Conversation
sdk/core/azure-core/src/main/java/com/azure/core/http/RequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/RequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/RequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/RequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/RequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/RequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/ResponseStatusOption.java
Outdated
Show resolved
Hide resolved
* @param requestCallback the request callback | ||
* @return the modified RequestOptions object | ||
*/ | ||
public RequestOptions addRequestCallback(Consumer<HttpRequest> requestCallback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requestCallback
may not convey the purpose of the callback. Other options:
addRequestModifier
addRequestProcessor
addRequestHandler
addRequestTransformation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sticking with requestCallback
for now and may revisit in the future
sdk/core/azure-core/src/main/java/com/azure/core/http/RequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/RequestOptions.java
Outdated
Show resolved
Hide resolved
@@ -286,7 +295,11 @@ private HttpRequest configRequest(final HttpRequest request, final SwaggerMethod | |||
} | |||
} | |||
|
|||
if (isJson) { | |||
if (bodyContentObject instanceof BinaryData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once it is merge this should use RequestContent
. Right now, this is creating another copy of the underlying BinaryData
data.
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RestProxy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RestProxy.java
Outdated
Show resolved
Hide resolved
* @return the request options | ||
*/ | ||
public RequestOptions setRequestOptions(Object[] swaggerMethodArguments) { | ||
return CoreUtils.findFirstOfType(swaggerMethodArguments, RequestOptions.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an ancillary performance question, does the Java proxy interface pass the Object[] in a consistent order? I'm wondering if there could be an optimization for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AutoRest generated code does, but I'm not sure if azure-core could make the assumption that all code follows the same order.
However, a CoreUtils.findLastOfType()
might slightly improve the perf.
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/samples/java/com/azure/core/http/RequestOptionsJavaDocCodeSnippets.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/samples/java/com/azure/core/http/RequestOptionsJavaDocCodeSnippets.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RequestOptions.java
Outdated
Show resolved
Hide resolved
90c12ce
to
0620138
Compare
[Hub Generated] Review request for Microsoft.DBforPostgreSQL to add version stable/2022-11-08 (Azure#22124) * Adds base for updating Microsoft.DBforPostgreSQL from version preview/2020-10-05-privatepreview to version 2022-11-08 * Updates readme * Updates API version in new specs and examples * empty commit (Azure#21932) Co-authored-by: Ozan Saka <[email protected]> * 2022 11 08 (Azure#22025) * Add private endpoint con. and private link endpoints * Add private link list example * Cluster related endpoint and exampled changes * Cluster changes and configuration updates * Long running operation header additions * Change server group to cluster * Add systemData to examples, fix private endpoint con. property * Fix private link resource name parameter * Fix INVALID_TYPE boolean given as strings * Update approve private endp. con. request body * Fix OBJECT_ADDITIONAL_PROPERTIES and READONLY_PROPERTY_NOT_ALLOWED_IN_REQUEST * Fix INVALID_TYPE * Fix ModelValidation Errors * Fix lint errors * Fix lint errors * Remove location from cluster examples * Update example details, fix common types * Update readme files, fix configuration example name * Fix SDK generation by removing wrong pageable tags * Update configuration response types, fix cluster name pattern * Update configuration example names * Readme changes and minor final state via fix * Fix indentation on suppression items * Update node count description, remove pec id * Update cluster examples * Style fix * Update description Co-authored-by: Ozan Saka <[email protected]> Co-authored-by: Sena Gungor <[email protected]> * Fix credscan password (Azure#22127) Co-authored-by: Ozan Saka <[email protected]> * Add required parameters (Azure#22244) * Add 200 resp. code to put&patch, change boolean to enum (Azure#22290) * Add 200 resp. code to put&patch, change boolean to enum * Update 200 responses * Update 200 response schemas, enum casing * Update configuration put requests * Remove role no-op case * fix private endp con list error, remove 200 code from role example * Add coord/node config list endpoints * fix sdk errors * add 200 resp for configuration put requests * Update readme * Fix arm feedbacks (Azure#22334) * Fix arm feedbacks * Add pointInTimeUTC * Update passwords and readme file * Update response codes to 201, address feedbacks (Azure#22386) * Update response codes to 201 * Add server configuration get * Update password * Fix duplicate operation id * Update configuration example files * Update configuration example files * Fix credscan issue (Azure#22389) * Fix PutRequestResponseScheme error (Azure#22408) * Fix PutRequestResponseScheme error * Update readme file * Update x-ms-mutability * Update property description * Fix server properties (Azure#22772) * Fix server properties --------- Co-authored-by: mozansaka <[email protected]> Co-authored-by: Ozan Saka <[email protected]>
No description provided.