2017-09-13 19:42:16 +03:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
|
|
|
|
import { WebResource } from "./webResource";
|
2018-05-14 20:49:05 +03:00
|
|
|
import { HttpHeaders } from "./httpHeaders";
|
2017-09-13 19:42:16 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wrapper object for http request and response. Deserialized object is stored in
|
2018-04-03 02:57:42 +03:00
|
|
|
* the `parsedBody` property when the response body is received in JSON or XML.
|
2017-09-13 19:42:16 +03:00
|
|
|
* @class
|
|
|
|
* Initializes a new instance of the HttpOperationResponse class.
|
|
|
|
* @constructor
|
|
|
|
*/
|
2018-05-14 20:49:05 +03:00
|
|
|
export interface HttpOperationResponse {
|
2017-09-13 19:42:16 +03:00
|
|
|
/**
|
|
|
|
* The raw request
|
|
|
|
*/
|
|
|
|
request: WebResource;
|
2018-05-14 20:49:05 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The HTTP response status (e.g. 200)
|
|
|
|
*/
|
|
|
|
status: number;
|
|
|
|
|
2017-09-13 19:42:16 +03:00
|
|
|
/**
|
2018-05-14 20:49:05 +03:00
|
|
|
* The HTTP response headers.
|
2017-09-13 19:42:16 +03:00
|
|
|
*/
|
2018-05-14 20:49:05 +03:00
|
|
|
headers: HttpHeaders;
|
|
|
|
|
2017-09-13 19:42:16 +03:00
|
|
|
/**
|
|
|
|
* The response body as text (string format)
|
|
|
|
*/
|
2018-03-27 03:54:26 +03:00
|
|
|
bodyAsText?: string | null;
|
|
|
|
|
2017-09-13 19:42:16 +03:00
|
|
|
/**
|
2018-03-27 03:54:26 +03:00
|
|
|
* The response body as parsed JSON or XML
|
2017-09-13 19:42:16 +03:00
|
|
|
*/
|
2018-05-14 20:49:05 +03:00
|
|
|
parsedBody?: any;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The response body as a Blob.
|
|
|
|
* Always undefined in node.js.
|
|
|
|
*/
|
|
|
|
blobBody?: (() => Promise<Blob>);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The response body as a node.js Readable stream.
|
|
|
|
* Always undefined in the browser.
|
|
|
|
*/
|
|
|
|
readableStreamBody?: NodeJS.ReadableStream;
|
2017-09-13 19:42:16 +03:00
|
|
|
}
|