主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

POST Cancel Request

取消请求

描述

使用 POST 方法取消请求。您只能取消那些尚未完成的请求。

请求

HTTP 方法

POST

URI

http://host:port/{request-uri-string}/cancel

响应

成功

HTTP 状态代码

204 No Content

错误

HTTP 状态代码

404 RequestNotFound

410 RequestAlreadyCompleted

410 RequestAlreadyCancelled

410 RequestAlreadyDeleted

500 InternalServerError

示例调用

HTTP

请求:

POST /~f76280c5-b94c-4cd9-8eb6-841532788583/requests/ef90fca4-0d3c-4395-8dc8-af8a8905b1fe/cancel HTTP/1.1
Host: localhost:9910 

响应:

Status Code: 204 No Content

JavaScript

var data = null;
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});
xhr.open("POST", "http://localhost:9910/~f76280c5-b94c-4cd9-8eb6-841532788583/requests/ef90fca4-0d3c-4395-8dc8-af8a8905b1fe/cancel");
xhr.send(data);

版本历史记录

在 R2016b 中推出