“正在加载"的HTTP状态代码 [英] HTTP status code for 'Loading'

查看:38
本文介绍了“正在加载"的HTTP状态代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

服务器接收到一个请求,但是决定该请求将花费很长时间才能处理,因此它以一个表示正在加载... 的站点作为响应.该站点将刷新自身,直到客户端收到表明(第一个)请求已被完全处理的响应为止.

A server receives a request, but decides that the request will take to long to process, so it responds with a site saying Loading.... The site will refresh itself until the client receives the response indicating that the (first) request has been completely processed.

正在加载... 网站最合适的状态代码是什么?

What's the most appropriate status code for this Loading... site?

我的猜测是它被 202接受.

推荐答案

HTTP是一个请求/响应协议.每个请求都返回一个响应.

HTTP is a request/response protocol. Each request returns a single response.

在您的示例中,初始请求成功返回了您的加载页面,因此"成功" 200代码是合适的.

In your example, the initial request successfully returns your loading page, and so the "success" 200 code is appropriate.

您在此页面然后生成更多数据的示例在HTTP的不同层上工作,因此不需要在HTTP级别添加语义

Your example of this page then generating further data is working at a different layer to HTTP, and so doesn't need to add semantics to the HTTP level

这篇关于“正在加载"的HTTP状态代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆