接收大文件的 web API 的 http 请求方法

Which http request method for web API which receives big files

哪个http request method适合接收大文件?

我的用例:我想提供一个 HTTP API:

由于服务器上没有数据被修改,我认为 POSTPUT 不适合。

AFAIK 方法 GET 不适合:

Web API 接收大文件的 http 请求方法是什么?

更新

更新2

假设您想为 calculate_square_root() 提供 HTTP API。如果您输入 9,您将收到 3。你会用“上传”这个词代替数字 9 吗?普通GET和大GET之间的界限在哪里?

要将文件内容发送到服务器,您应该使用 POST 请求:

4.3.3. POST

The POST method requests that the target resource process the representation enclosed in the request according to the resource's own specific semantics. For example, POST is used for the following functions (among others):

  • Providing a block of data, such as the fields entered into an HTML form, to a data-handling process; [...]

文件的内容将在请求的负载中发送,Content-Type of the request should be set to multipart/form-data

要发送文件内容等大数据,您应该使用 POST 请求。

对于在服务器端上传文件,请求的 'Content-Type' 应该是 multipart/form-data。

引用自 RFC:HTTP 1.1 Method Definitions 这似乎是 POST。

The actual function performed by the POST method is determined by the server ...

The action performed by the POST method might not result in a resource that can be identified by a URI. ...

If a resource has been created on the origin server,...

最后两点似乎清楚地支持了服务器可以只处理数据而不存储任何东西的观点