上传下载 支持监听任务响应头 新增接口

Signed-off-by: hu-kai45 <hukai45@huawei.com>
This commit is contained in:
hu-kai45 2024-02-04 10:28:54 +08:00
parent 4a717bb612
commit 701446e11e

View File

@ -4033,6 +4033,52 @@ declare namespace request {
readonly extras?: object;
}
/**
* The HTTP response.
*
* @interface HttpResponse
* @syscap SystemCapability.Request.FileTransferAgent
* @since 12
*/
interface HttpResponse {
/**
* The version of the HTTP response.
*
* @type { string }
* @readonly
* @syscap SystemCapability.Request.FileTransferAgent
* @since 12
*/
readonly version: string,
/**
* The status code of the HTTP response.
*
* @type { number }
* @readonly
* @syscap SystemCapability.Request.FileTransferAgent
* @since 12
*/
readonly statusCode: number,
/**
* The reason of the HTTP response.
*
* @type { string }
* @readonly
* @syscap SystemCapability.Request.FileTransferAgent
* @since 12
*/
readonly reason: string,
/**
* The headers of the HTTP response.
*
* @type { Map<string, Array<string>> }
* @readonly
* @syscap SystemCapability.Request.FileTransferAgent
* @since 12
*/
readonly headers: Map<string, Array<string>>,
}
/**
* The task entry.
* New task' status is "initialized" and enqueue.
@ -4290,6 +4336,24 @@ declare namespace request {
* @since 11
*/
off(event: 'remove', callback?: (progress: Progress) => void): void;
/**
* Enables the response callback.
*
* @param { 'response' } event - event types.
* @param { Callback<HttpResponse> } callback - callback function with an `HttpResponse` argument.
* @syscap SystemCapability.Request.FileTransferAgent
* @since 12
*/
on(event: 'response', callback: Callback<HttpResponse>): void;
/**
* Disables the response callback.
*
* @param { 'response' } event - event types.
* @param { Callback<HttpResponse> } callback - callback function with an `HttpResponse` argument.
* @syscap SystemCapability.Request.FileTransferAgent
* @since 12
*/
off(event: 'response', callback?: Callback<HttpResponse>): void;
/**
* Starts the task.
*