我想知道 $http 是否可以使用 LINK/UNLINK 方法(如 POST、GET、PUT、PATCH ..)向服务器发送 ajax 请求。我已经在 AngularJS 文档中进行了搜索,只找到了以下可用方法列表:
- $http.get
- $http.head
- $http.post
- $http.put
- $http.delete
- $http.jsonp
- $http.补丁
当您只想在资源之间建立关系时,LINK 方法非常有用,如果缺少它真的很可惜。如果有人知道如何做这个请求,可以给我一个例子吗?
LINK/UNLINK 方法示例:
There exists a broad range of possible use cases for the LINK and UNLINK methods. The examples that follow illustrate a subset of those cases.
Example 1: Creating two separate links between an image and the profiles of two people associated with the image:
LINK /images/my_dog.jpg HTTP/1.1
Host: example.org
Link: <http://example.com/profiles/joe>; rel="tag"
Link: <http://example.com/profiles/sally>; rel="tag"
Example 2: Removing an existing Link relationship between two resources:
UNLINK /images/my_dog.jpg HTTP/1.1
Host: example.org
Link: <http://example.com/profiles/sally>; rel="tag"
以下是有关 LINK 方法的一些文档:
http://www.w3.org/Protocols/HTTP/Methods/Link.html
http://tools.ietf.org/id/draft-snell-link-method-01.html#RFC5988