UNPKG

1.9 kBTypeScriptView Raw
1import { HttpOperationResponse } from "../httpOperationResponse";
2import { WebResourceLike } from "../webResource";
3import { BaseRequestPolicy, RequestPolicy, RequestPolicyFactory, RequestPolicyOptionsLike } from "./requestPolicy";
4/**
5 * The content-types that will indicate that an operation response should be deserialized in a
6 * particular way.
7 */
8export interface DeserializationContentTypes {
9 /**
10 * The content-types that indicate that an operation response should be deserialized as JSON.
11 * Defaults to [ "application/json", "text/json" ].
12 */
13 json?: string[];
14 /**
15 * The content-types that indicate that an operation response should be deserialized as XML.
16 * Defaults to [ "application/xml", "application/atom+xml" ].
17 */
18 xml?: string[];
19}
20/**
21 * Create a new serialization RequestPolicyCreator that will serialized HTTP request bodies as they
22 * pass through the HTTP pipeline.
23 */
24export declare function deserializationPolicy(deserializationContentTypes?: DeserializationContentTypes): RequestPolicyFactory;
25export declare const defaultJsonContentTypes: string[];
26export declare const defaultXmlContentTypes: string[];
27/**
28 * A RequestPolicy that will deserialize HTTP response bodies and headers as they pass through the
29 * HTTP pipeline.
30 */
31export declare class DeserializationPolicy extends BaseRequestPolicy {
32 readonly jsonContentTypes: string[];
33 readonly xmlContentTypes: string[];
34 constructor(nextPolicy: RequestPolicy, deserializationContentTypes: DeserializationContentTypes | undefined, options: RequestPolicyOptionsLike);
35 sendRequest(request: WebResourceLike): Promise<HttpOperationResponse>;
36}
37export declare function deserializeResponseBody(jsonContentTypes: string[], xmlContentTypes: string[], response: HttpOperationResponse): Promise<HttpOperationResponse>;
38//# sourceMappingURL=deserializationPolicy.d.ts.map
\No newline at end of file