-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Set appropriate Accept header for Search clients #11562
Conversation
@pakrym I had to switch the order of sanitizing variables and content so that we can properly capture which variables need to be sanitized from content. @tg-msft @brjohnstmsft I noticed from some of the test recordings that when we get a
I noticed that Java may have the same problem, too, since it passes the pipeline. /cc @sima-zhu @alzimmermsft |
sdk/search/Azure.Search.Documents/src/Pipeline/OdataMetadataPolicy.cs
Outdated
Show resolved
Hide resolved
sdk/search/Azure.Search.Documents/src/Pipeline/OdataMetadataPolicy.cs
Outdated
Show resolved
Hide resolved
sdk/search/Azure.Search.Documents/src/Pipeline/OdataMetadataPolicy.cs
Outdated
Show resolved
Hide resolved
Here's a transform that I think does what you're looking for: Add Accept headerReturn no metadata for /docs operations and minimal for the rest. directive:
- from: swagger-document
where: $.paths
transform: >
for (var path in $) {
for (var opName in $[path]) {
var op = $[path][opName];
var accept = "application/json;odata.metadata=";
accept += path.startsWith("/docs") ? "none" : "minimal";
op.parameters.push({
name: "Accept",
"in": "header",
required: true,
type: "string",
enum: [accept],
"x-ms-parameter-location": "method"
});
}
}
return $; |
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.
Looks good!
Fixes #11532