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 $; |
Fixes #11532