├── .gitignore ├── .vscode └── settings.json ├── Dockerfile ├── README.md ├── api ├── index.ts └── tsconfig.json ├── assets ├── apifox.webp └── hello.jpg ├── components └── CodeTitle.tsx ├── docker-compose.yaml ├── lib ├── code.json └── ga.ts ├── next-env.d.ts ├── next-sitemap.config.js ├── next.config.mjs ├── package.json ├── pages ├── 100.mdx ├── 101.mdx ├── 102.mdx ├── 103.mdx ├── 200.mdx ├── 201.mdx ├── 202.mdx ├── 203.mdx ├── 204.mdx ├── 205.mdx ├── 206.mdx ├── 207.mdx ├── 208.mdx ├── 226.mdx ├── 300.mdx ├── 301.mdx ├── 302.mdx ├── 303.mdx ├── 304.mdx ├── 305.mdx ├── 307.mdx ├── 308.mdx ├── 400.mdx ├── 401.mdx ├── 402.mdx ├── 403.mdx ├── 405.mdx ├── 406.mdx ├── 407.mdx ├── 408.mdx ├── 409.mdx ├── 410.mdx ├── 411.mdx ├── 412.mdx ├── 413.mdx ├── 414.mdx ├── 415.mdx ├── 416.mdx ├── 417.mdx ├── 418.mdx ├── 421.mdx ├── 422.mdx ├── 423.mdx ├── 424.mdx ├── 426.mdx ├── 428.mdx ├── 429.mdx ├── 431.mdx ├── 444.mdx ├── 451.mdx ├── 499.mdx ├── 500.mdx ├── 501.mdx ├── 502.mdx ├── 503.mdx ├── 504.mdx ├── 505.mdx ├── 506.mdx ├── 507.mdx ├── 508.mdx ├── 510.mdx ├── 511.mdx ├── 599.mdx ├── _app.tsx ├── _document.tsx ├── about.tsx ├── api │ └── hello.ts ├── demo │ └── upload.tsx ├── index.tsx └── not-found.mdx ├── pnpm-lock.yaml ├── postcss.config.js ├── public ├── favicon.ico ├── robots.txt ├── sitemap-0.xml └── sitemap.xml ├── serverless.yaml ├── styles └── index.css ├── tailwind.config.js ├── tsconfig.json └── vercel.json /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | 21 | # debug 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | # local env files 27 | .env.local 28 | .env.development.local 29 | .env.test.local 30 | .env.production.local 31 | .env_temp 32 | 33 | # serverless 34 | .serverless 35 | 36 | package-lock.json 37 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine 2 | 3 | RUN corepack enable 4 | WORKDIR /code 5 | ADD package.json pnpm-lock.yaml /code/ 6 | RUN pnpm i 7 | 8 | ADD . /code 9 | RUN pnpm build 10 | 11 | EXPOSE 3000 12 | CMD npm start 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HTTP STATUS 2 | 3 | [HTTP.DEVTOOL.TECH](https://http.devtool.tech) 可通过路径名称直接访问到对应的状态码。如: 4 | 5 | + :关于 200 状态码的解释说明 6 | + :关于 201 状态码的解释说明 7 | + :关于 404 状态码的解释说明 8 | 9 | 本网站内容参考以下网站 10 | 11 | + [rmaake1/httpstatuses](https://github.com/rmaake1/httpstatuses),间接来自于 RFC 12 | + [http.cat](https://http.cat/) 13 | + [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) 14 | 15 | ## 工具推荐 16 | 17 | + [Apifox: API 文档、API 调试、API Mock、API 自动化测试](https://www.apifox.cn/?utm_source=shanyue-question) 18 | + [API Hub](https://www.apifox.cn/apihub/) 19 | + [Apifox Echo](https://echo.apifox.com) 20 | 21 | ## 代码示例 22 | 23 | + [图片上传](https://http.devtool.tech/demo/upload) 24 | 25 | ## API 26 | 27 | 除了状态码,本站还提供了 API 用于 HTTP 测试。 28 | 29 | ### Cookie 30 | 31 | 获取所有 Cookie,配置 Cookie,并支持配置属性如 Domain、Path、SameSite、MaxAge 等。 32 | 33 | ``` bash 34 | # 获取 Cookies 35 | $ curl https://http.devtool.tech/api/cookies 36 | 37 | # 配置 Cookie 为 a: 3 38 | $ curl https://http.devtool.tech/api/cookies/set/a/3 39 | 40 | # 配置 Cookie 为 a: 3,且 httpOnly: true, secure: true, maxAge: 100, sameSite: Lax 41 | $ curl https://http.devtool.tech/api/cookies/set/a/3?secure=true&httpOnly=true&maxAge=100&sameSite=Lax 42 | ``` 43 | 44 | ### 缓存 45 | 46 | 配置服务器端的 `Cache Control` 以及 `Age` 属性,用以测试缓存。 47 | 48 | > 目前部署在 Vercel 中,Age 会被 Proxy 所拦截。 49 | 50 | ``` bash 51 | # 配置 Cache-Control 52 | $ curl https://http.devtool.tech/api/cache?cacheControl=no-store&age=1000 53 | 54 | # 配置 Cache-Control: 100 55 | $ curl https://http.devtool.tech/api/cache/100 56 | 57 | # 配置 Cache-Control: 31536000 58 | $ curl https://http.devtool.tech/api/cache/31536000 59 | ``` 60 | -------------------------------------------------------------------------------- /api/index.ts: -------------------------------------------------------------------------------- 1 | import Koa from 'koa' 2 | import Router from 'koa-router' 3 | import koaBody from 'koa-body' 4 | import cookie from 'cookie' 5 | import * as _ from 'midash' 6 | import cors from '@koa/cors' 7 | import { createWriteStream } from 'fs' 8 | 9 | import OSS from 'ali-oss' 10 | import { createReadStream } from 'fs' 11 | import { resolve } from 'path' 12 | import { Stream } from 'stream' 13 | import { nextTick } from 'process' 14 | 15 | const sleep = (seconds: number) => new Promise(resolve => setTimeout(resolve, seconds)) 16 | 17 | const client = new OSS({ 18 | region: 'oss-cn-beijing', 19 | accessKeyId: process.env.ACCESS_KEY_ID as string, 20 | accessKeySecret: process.env.ACCESS_KEY_SECRET as string, 21 | bucket: 'shanyue-static' 22 | }) 23 | 24 | const router = new Router() 25 | const app = new Koa({ 26 | proxy: true 27 | }) 28 | 29 | router.get('/api', ctx => { 30 | ctx.body = 'hello, world' 31 | }) 32 | 33 | router.get('/api/cache', ctx => { 34 | const { cacheControl, age } = ctx.query 35 | if (cacheControl) { 36 | ctx.set('Cache-Control', cacheControl) 37 | } 38 | if (age) { 39 | ctx.set('Age', age) 40 | } 41 | const headers = ctx.res.getHeaders() 42 | ctx.body = headers 43 | }) 44 | 45 | router.get('/api/cache/:duration', ctx => { 46 | ctx.set('Cache-Control', `max-age=${ctx.params.duration}`) 47 | const headers = ctx.res.getHeaders() 48 | ctx.body = headers 49 | }) 50 | 51 | router.get('/api/cookies', ctx => { 52 | const cookies = cookie.parse(ctx.req.headers.cookie || '') 53 | ctx.body = cookies || {} 54 | }) 55 | 56 | router.get('/api/cookies/set/:key/:value', ctx => { 57 | const { key, value } = ctx.params; 58 | ctx.cookies.set(key, value, { 59 | ..._.pick(ctx.query, [ 60 | 'maxAge', 61 | 'path', 62 | 'domain', 63 | 'sameSite' 64 | ]) as any, 65 | maxAge: Number(ctx.query.maxAge || 0) * 1000, 66 | httpOnly: ctx.query.httpOnly === 'true', 67 | secure: ctx.query.secure === 'true' 68 | }); 69 | ctx.redirect('/api/cookies') 70 | }) 71 | 72 | router.get('/api/stream', async ctx => { 73 | const res = ctx.res; 74 | res.statusCode = 200; 75 | ctx.set('Transfer-Encoding', 'chunked'); 76 | res.write(` 77 | 78 | 79 | 80 | 81 | 测试页面 82 | 83 | ` 84 | ) 85 | await sleep(2000) 86 | res.write('

hello, shanyue

') 87 | await sleep(2000) 88 | res.write('
这里是大段文字,将会延迟两秒才会正常渲染
') 89 | await sleep(2000) 90 | res.write('
这里又是大段文字,将会延迟两秒才会正常渲染
') 91 | await sleep(1000) 92 | res.write('代码: https://github.com/shfshanyue/httpstatus/blob/master/api/index.ts') 93 | res.end(` 94 | 95 | 96 | `) 97 | }) 98 | 99 | router.post('/api/upload-jpeg', async (ctx, next) => { 100 | const random = Math.random().toString(16) 101 | const r = await client.putStream(`demo/${random}.jpg`, ctx.req) 102 | ctx.body = { 103 | src: `https://static.shanyue.tech/${r.name}` 104 | } 105 | }) 106 | 107 | app.use(async (ctx, next) => { 108 | if (ctx.query.cors === 'true') { 109 | await cors({ 110 | origin: ctx.query.origin as string || undefined, 111 | credentials: ctx.query.credentials === 'true' 112 | }).call(this, ctx, next) 113 | } else { 114 | await next() 115 | } 116 | }) 117 | 118 | app.use(koaBody()) 119 | app 120 | .use(router.routes()) 121 | .use(router.allowedMethods()) 122 | 123 | export default app.callback() 124 | 125 | if (require.main) { 126 | app.listen(8000, () => { 127 | console.log('Listing 8000') 128 | }) 129 | } -------------------------------------------------------------------------------- /api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "strict": true, 12 | "forceConsistentCasingInFileNames": true, 13 | "noEmit": true, 14 | "esModuleInterop": true, 15 | "module": "CommonJS", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "jsx": "preserve", 20 | "incremental": true 21 | }, 22 | "exclude": [ 23 | "node_modules" 24 | ], 25 | "include": [ 26 | "next-env.d.ts", 27 | "**/*.ts", 28 | "**/*.tsx" 29 | , "../pages/api/upload-jpeg.ts" ] 30 | } 31 | -------------------------------------------------------------------------------- /assets/apifox.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shfshanyue/httpstatus/63932e70b2d0ae821186378154654c039646124f/assets/apifox.webp -------------------------------------------------------------------------------- /assets/hello.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shfshanyue/httpstatus/63932e70b2d0ae821186378154654c039646124f/assets/hello.jpg -------------------------------------------------------------------------------- /components/CodeTitle.tsx: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | import Image from 'next/image' 3 | import { Helmet } from 'react-helmet' 4 | 5 | export default function CodeTitle ({ code, title }: Record) { 6 | return ( 7 | <> 8 | 11 |
12 | 13 | ← 返回 http.devtool.tech 14 | 15 |
16 |

17 | {code} 18 | {title} 19 |

20 | {code} 21 | 22 | ) 23 | } -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | shici: 4 | build: . 5 | restart: always 6 | labels: 7 | - traefik.http.routers.next-app.rule=Host(`next-app.shanyue.tech`) 8 | - traefik.http.routers.next-app.tls=true 9 | - traefik.http.routers.next-app.tls.certresolver=le 10 | 11 | networks: 12 | default: 13 | external: 14 | name: traefik_default 15 | -------------------------------------------------------------------------------- /lib/code.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "code": 202, 4 | "phrase": "Accepted", 5 | "constant": "ACCEPTED", 6 | "comment": { 7 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.3", 8 | "description": "The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing." 9 | } 10 | }, 11 | { 12 | "code": 502, 13 | "phrase": "Bad Gateway", 14 | "constant": "BAD_GATEWAY", 15 | "comment": { 16 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.3", 17 | "description": "This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response." 18 | } 19 | }, 20 | { 21 | "code": 400, 22 | "phrase": "Bad Request", 23 | "constant": "BAD_REQUEST", 24 | "comment": { 25 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.1", 26 | "description": "This response means that server could not understand the request due to invalid syntax." 27 | } 28 | }, 29 | { 30 | "code": 409, 31 | "phrase": "Conflict", 32 | "constant": "CONFLICT", 33 | "comment": { 34 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8", 35 | "description": "This response is sent when a request conflicts with the current state of the server." 36 | } 37 | }, 38 | { 39 | "code": 100, 40 | "phrase": "Continue", 41 | "constant": "CONTINUE", 42 | "comment": { 43 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1", 44 | "description": "This interim response indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished." 45 | } 46 | }, 47 | { 48 | "code": 201, 49 | "phrase": "Created", 50 | "constant": "CREATED", 51 | "comment": { 52 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2", 53 | "description": "The request has succeeded and a new resource has been created as a result of it. This is typically the response sent after a PUT request." 54 | } 55 | }, 56 | { 57 | "code": 417, 58 | "phrase": "Expectation Failed", 59 | "constant": "EXPECTATION_FAILED", 60 | "comment": { 61 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.14", 62 | "description": "This response code means the expectation indicated by the Expect request header field can't be met by the server." 63 | } 64 | }, 65 | { 66 | "code": 424, 67 | "phrase": "Failed Dependency", 68 | "constant": "FAILED_DEPENDENCY", 69 | "comment": { 70 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.5", 71 | "description": "The request failed due to failure of a previous request." 72 | } 73 | }, 74 | { 75 | "code": 403, 76 | "phrase": "Forbidden", 77 | "constant": "FORBIDDEN", 78 | "comment": { 79 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3", 80 | "description": "The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to give proper response. Unlike 401, the client's identity is known to the server." 81 | } 82 | }, 83 | { 84 | "code": 504, 85 | "phrase": "Gateway Timeout", 86 | "constant": "GATEWAY_TIMEOUT", 87 | "comment": { 88 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.5", 89 | "description": "This error response is given when the server is acting as a gateway and cannot get a response in time." 90 | } 91 | }, 92 | { 93 | "code": 410, 94 | "phrase": "Gone", 95 | "constant": "GONE", 96 | "comment": { 97 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9", 98 | "description": "This response would be sent when the requested content has been permenantly deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. The HTTP specification intends this status code to be used for \"limited-time, promotional services\". APIs should not feel compelled to indicate resources that have been deleted with this status code." 99 | } 100 | }, 101 | { 102 | "code": 505, 103 | "phrase": "HTTP Version Not Supported", 104 | "constant": "HTTP_VERSION_NOT_SUPPORTED", 105 | "comment": { 106 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.6", 107 | "description": "The HTTP version used in the request is not supported by the server." 108 | } 109 | }, 110 | { 111 | "code": 418, 112 | "phrase": "I'm a teapot", 113 | "constant": "IM_A_TEAPOT", 114 | "comment": { 115 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc2324#section-2.3.2", 116 | "description": "Any attempt to brew coffee with a teapot should result in the error code \"418 I'm a teapot\". The resulting entity body MAY be short and stout." 117 | } 118 | }, 119 | { 120 | "code": 419, 121 | "phrase": "Insufficient Space on Resource", 122 | "constant": "INSUFFICIENT_SPACE_ON_RESOURCE", 123 | "comment": { 124 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6", 125 | "description": "The 507 (Insufficient Storage) status code means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request. This condition is considered to be temporary. If the request which received this status code was the result of a user action, the request MUST NOT be repeated until it is requested by a separate user action." 126 | } 127 | }, 128 | { 129 | "code": 507, 130 | "phrase": "Insufficient Storage", 131 | "constant": "INSUFFICIENT_STORAGE", 132 | "comment": { 133 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6", 134 | "description": "The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process." 135 | } 136 | }, 137 | { 138 | "code": 500, 139 | "phrase": "Internal Server Error", 140 | "constant": "INTERNAL_SERVER_ERROR", 141 | "comment": { 142 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.1", 143 | "description": "The server encountered an unexpected condition that prevented it from fulfilling the request." 144 | } 145 | }, 146 | { 147 | "code": 411, 148 | "phrase": "Length Required", 149 | "constant": "LENGTH_REQUIRED", 150 | "comment": { 151 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.10", 152 | "description": "The server rejected the request because the Content-Length header field is not defined and the server requires it." 153 | } 154 | }, 155 | { 156 | "code": 423, 157 | "phrase": "Locked", 158 | "constant": "LOCKED", 159 | "comment": { 160 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.4", 161 | "description": "The resource that is being accessed is locked." 162 | } 163 | }, 164 | { 165 | "code": 420, 166 | "phrase": "Method Failure", 167 | "constant": "METHOD_FAILURE", 168 | "isDeprecated": true, 169 | "comment": { 170 | "doc": "Official Documentation @ https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt", 171 | "description": "A deprecated response used by the Spring Framework when a method has failed." 172 | } 173 | }, 174 | { 175 | "code": 405, 176 | "phrase": "Method Not Allowed", 177 | "constant": "METHOD_NOT_ALLOWED", 178 | "comment": { 179 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5", 180 | "description": "The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code." 181 | } 182 | }, 183 | { 184 | "code": 301, 185 | "phrase": "Moved Permanently", 186 | "constant": "MOVED_PERMANENTLY", 187 | "comment": { 188 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.2", 189 | "description": "This response code means that URI of requested resource has been changed. Probably, new URI would be given in the response." 190 | } 191 | }, 192 | { 193 | "code": 302, 194 | "phrase": "Moved Temporarily", 195 | "constant": "MOVED_TEMPORARILY", 196 | "comment": { 197 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.3", 198 | "description": "This response code means that URI of requested resource has been changed temporarily. New changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests." 199 | } 200 | }, 201 | { 202 | "code": 207, 203 | "phrase": "Multi-Status", 204 | "constant": "MULTI_STATUS", 205 | "comment": { 206 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.2", 207 | "description": "A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate." 208 | } 209 | }, 210 | { 211 | "code": 300, 212 | "phrase": "Multiple Choices", 213 | "constant": "MULTIPLE_CHOICES", 214 | "comment": { 215 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.1", 216 | "description": "The request has more than one possible responses. User-agent or user should choose one of them. There is no standardized way to choose one of the responses." 217 | } 218 | }, 219 | { 220 | "code": 511, 221 | "phrase": "Network Authentication Required", 222 | "constant": "NETWORK_AUTHENTICATION_REQUIRED", 223 | "comment": { 224 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc6585#section-6", 225 | "description": "The 511 status code indicates that the client needs to authenticate to gain network access." 226 | } 227 | }, 228 | { 229 | "code": 204, 230 | "phrase": "No Content", 231 | "constant": "NO_CONTENT", 232 | "comment": { 233 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5", 234 | "description": "There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones." 235 | } 236 | }, 237 | { 238 | "code": 203, 239 | "phrase": "Non Authoritative Information", 240 | "constant": "NON_AUTHORITATIVE_INFORMATION", 241 | "comment": { 242 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.4", 243 | "description": "This response code means returned meta-information set is not exact set as available from the origin server, but collected from a local or a third party copy. Except this condition, 200 OK response should be preferred instead of this response." 244 | } 245 | }, 246 | { 247 | "code": 406, 248 | "phrase": "Not Acceptable", 249 | "constant": "NOT_ACCEPTABLE", 250 | "comment": { 251 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.6", 252 | "description": "This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content following the criteria given by the user agent." 253 | } 254 | }, 255 | { 256 | "code": 404, 257 | "phrase": "Not Found", 258 | "constant": "NOT_FOUND", 259 | "comment": { 260 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.4", 261 | "description": "The server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurence on the web." 262 | } 263 | }, 264 | { 265 | "code": 501, 266 | "phrase": "Not Implemented", 267 | "constant": "NOT_IMPLEMENTED", 268 | "comment": { 269 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2", 270 | "description": "The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD." 271 | } 272 | }, 273 | { 274 | "code": 304, 275 | "phrase": "Not Modified", 276 | "constant": "NOT_MODIFIED", 277 | "comment": { 278 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1", 279 | "description": "This is used for caching purposes. It is telling to client that response has not been modified. So, client can continue to use same cached version of response." 280 | } 281 | }, 282 | { 283 | "code": 200, 284 | "phrase": "OK", 285 | "constant": "OK", 286 | "comment": { 287 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1", 288 | "description": "The request has succeeded. The meaning of a success varies depending on the HTTP method:\nGET: The resource has been fetched and is transmitted in the message body.\nHEAD: The entity headers are in the message body.\nPOST: The resource describing the result of the action is transmitted in the message body.\nTRACE: The message body contains the request message as received by the server" 289 | } 290 | }, 291 | { 292 | "code": 206, 293 | "phrase": "Partial Content", 294 | "constant": "PARTIAL_CONTENT", 295 | "comment": { 296 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.1", 297 | "description": "This response code is used because of range header sent by the client to separate download into multiple streams." 298 | } 299 | }, 300 | { 301 | "code": 402, 302 | "phrase": "Payment Required", 303 | "constant": "PAYMENT_REQUIRED", 304 | "comment": { 305 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2", 306 | "description": "This response code is reserved for future use. Initial aim for creating this code was using it for digital payment systems however this is not used currently." 307 | } 308 | }, 309 | { 310 | "code": 308, 311 | "phrase": "Permanent Redirect", 312 | "constant": "PERMANENT_REDIRECT", 313 | "comment": { 314 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7538#section-3", 315 | "description": "This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request." 316 | } 317 | }, 318 | { 319 | "code": 412, 320 | "phrase": "Precondition Failed", 321 | "constant": "PRECONDITION_FAILED", 322 | "comment": { 323 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.2", 324 | "description": "The client has indicated preconditions in its headers which the server does not meet." 325 | } 326 | }, 327 | { 328 | "code": 428, 329 | "phrase": "Precondition Required", 330 | "constant": "PRECONDITION_REQUIRED", 331 | "comment": { 332 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc6585#section-3", 333 | "description": "The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict." 334 | } 335 | }, 336 | { 337 | "code": 102, 338 | "phrase": "Processing", 339 | "constant": "PROCESSING", 340 | "comment": { 341 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.1", 342 | "description": "This code indicates that the server has received and is processing the request, but no response is available yet." 343 | } 344 | }, 345 | { 346 | "code": 407, 347 | "phrase": "Proxy Authentication Required", 348 | "constant": "PROXY_AUTHENTICATION_REQUIRED", 349 | "comment": { 350 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.2", 351 | "description": "This is similar to 401 but authentication is needed to be done by a proxy." 352 | } 353 | }, 354 | { 355 | "code": 431, 356 | "phrase": "Request Header Fields Too Large", 357 | "constant": "REQUEST_HEADER_FIELDS_TOO_LARGE", 358 | "comment": { 359 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5", 360 | "description": "The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields." 361 | } 362 | }, 363 | { 364 | "code": 408, 365 | "phrase": "Request Timeout", 366 | "constant": "REQUEST_TIMEOUT", 367 | "comment": { 368 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7", 369 | "description": "This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message." 370 | } 371 | }, 372 | { 373 | "code": 413, 374 | "phrase": "Request Entity Too Large", 375 | "constant": "REQUEST_TOO_LONG", 376 | "comment": { 377 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11", 378 | "description": "Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field." 379 | } 380 | }, 381 | { 382 | "code": 414, 383 | "phrase": "Request-URI Too Long", 384 | "constant": "REQUEST_URI_TOO_LONG", 385 | "comment": { 386 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.12", 387 | "description": "The URI requested by the client is longer than the server is willing to interpret." 388 | } 389 | }, 390 | { 391 | "code": 416, 392 | "phrase": "Requested Range Not Satisfiable", 393 | "constant": "REQUESTED_RANGE_NOT_SATISFIABLE", 394 | "comment": { 395 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.4", 396 | "description": "The range specified by the Range header field in the request can't be fulfilled; it's possible that the range is outside the size of the target URI's data." 397 | } 398 | }, 399 | { 400 | "code": 205, 401 | "phrase": "Reset Content", 402 | "constant": "RESET_CONTENT", 403 | "comment": { 404 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.6", 405 | "description": "This response code is sent after accomplishing request to tell user agent reset document view which sent this request." 406 | } 407 | }, 408 | { 409 | "code": 303, 410 | "phrase": "See Other", 411 | "constant": "SEE_OTHER", 412 | "comment": { 413 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.4", 414 | "description": "Server sent this response to directing client to get requested resource to another URI with an GET request." 415 | } 416 | }, 417 | { 418 | "code": 503, 419 | "phrase": "Service Unavailable", 420 | "constant": "SERVICE_UNAVAILABLE", 421 | "comment": { 422 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.4", 423 | "description": "The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This responses should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached." 424 | } 425 | }, 426 | { 427 | "code": 101, 428 | "phrase": "Switching Protocols", 429 | "constant": "SWITCHING_PROTOCOLS", 430 | "comment": { 431 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2", 432 | "description": "This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too." 433 | } 434 | }, 435 | { 436 | "code": 307, 437 | "phrase": "Temporary Redirect", 438 | "constant": "TEMPORARY_REDIRECT", 439 | "comment": { 440 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.7", 441 | "description": "Server sent this response to directing client to get requested resource to another URI with same method that used prior request. This has the same semantic than the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request." 442 | } 443 | }, 444 | { 445 | "code": 429, 446 | "phrase": "Too Many Requests", 447 | "constant": "TOO_MANY_REQUESTS", 448 | "comment": { 449 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4", 450 | "description": "The user has sent too many requests in a given amount of time (\"rate limiting\")." 451 | } 452 | }, 453 | { 454 | "code": 401, 455 | "phrase": "Unauthorized", 456 | "constant": "UNAUTHORIZED", 457 | "comment": { 458 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1", 459 | "description": "Although the HTTP standard specifies \"unauthorized\", semantically this response means \"unauthenticated\". That is, the client must authenticate itself to get the requested response." 460 | } 461 | }, 462 | { 463 | "code": 451, 464 | "phrase": "Unavailable For Legal Reasons", 465 | "constant": "UNAVAILABLE_FOR_LEGAL_REASONS", 466 | "comment": { 467 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7725", 468 | "description": "The user-agent requested a resource that cannot legally be provided, such as a web page censored by a government." 469 | } 470 | }, 471 | { 472 | "code": 422, 473 | "phrase": "Unprocessable Entity", 474 | "constant": "UNPROCESSABLE_ENTITY", 475 | "comment": { 476 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3", 477 | "description": "The request was well-formed but was unable to be followed due to semantic errors." 478 | } 479 | }, 480 | { 481 | "code": 415, 482 | "phrase": "Unsupported Media Type", 483 | "constant": "UNSUPPORTED_MEDIA_TYPE", 484 | "comment": { 485 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13", 486 | "description": "The media format of the requested data is not supported by the server, so the server is rejecting the request." 487 | } 488 | }, 489 | { 490 | "code": 305, 491 | "phrase": "Use Proxy", 492 | "constant": "USE_PROXY", 493 | "isDeprecated": true, 494 | "comment": { 495 | "doc": "Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.6", 496 | "description": "Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy." 497 | } 498 | }, 499 | { 500 | "code": 421, 501 | "phrase": "Misdirected Request", 502 | "constant": "MISDIRECTED_REQUEST", 503 | "isDeprecated": false, 504 | "comment": { 505 | "doc": "Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2", 506 | "description": "Defined in the specification of HTTP/2 to indicate that a server is not able to produce a response for the combination of scheme and authority that are included in the request URI." 507 | } 508 | } 509 | ] -------------------------------------------------------------------------------- /lib/ga.ts: -------------------------------------------------------------------------------- 1 | import ReactGA from 'react-ga' 2 | 3 | export const initGA = () => { 4 | // 设置 GA code 5 | ReactGA.initialize(process.env.gaId || '') 6 | } 7 | 8 | export const logPageView = () => { 9 | ReactGA.set({ page: window.location.pathname }) 10 | ReactGA.pageview(window.location.pathname) 11 | } 12 | -------------------------------------------------------------------------------- /next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /next-sitemap.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | siteUrl: 'https://next-app-shanyue.vercel.app', 3 | generateRobotsTxt: true, 4 | // optional 5 | robotsTxtOptions: { 6 | additionalSitemaps: [ 7 | ], 8 | }, 9 | exclude: [] 10 | } 11 | -------------------------------------------------------------------------------- /next.config.mjs: -------------------------------------------------------------------------------- 1 | import withBundleAnalyzer from '@next/bundle-analyzer' 2 | import remarkFrontmatter from 'remark-frontmatter' 3 | import remarkMdxFrontmatter from 'remark-mdx-frontmatter' 4 | import withMDX from '@next/mdx' 5 | 6 | const config = { 7 | swcMinify: true, 8 | env: { 9 | // 极客时间 ID 10 | gaId: 'UA-102193749-5', 11 | // Devtool ID 12 | gtmId: 'G-B0BG6J2K56', 13 | baiduToken: 'code-qSWZ8u5lnF' 14 | }, 15 | images: { 16 | domains: ['http.cat'], 17 | formats: ['image/avif', 'image/webp'], 18 | }, 19 | webpack(config) { 20 | return config 21 | }, 22 | pageExtensions: ['js', 'jsx', 'mdx', 'tsx'] 23 | } 24 | 25 | export default withMDX({ 26 | extension: /\.mdx?$/, 27 | options: { 28 | remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter] 29 | } 30 | })( 31 | withBundleAnalyzer({ 32 | enabled: process.env.ANALYZE === 'true' 33 | })(config) 34 | ) 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "next-app", 3 | "license": "MIT", 4 | "version": "1.0.0", 5 | "bugs": { 6 | "url": "https://github.com/shfshanyue/next-app/issues" 7 | }, 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/shfshanyue/next-app" 11 | }, 12 | "scripts": { 13 | "dev": "next dev", 14 | "dev:api": "nodemon api/index.ts", 15 | "build": "next build", 16 | "start": "next start", 17 | "postbuild": "next-sitemap" 18 | }, 19 | "dependencies": { 20 | "@koa/cors": "^4.0.0", 21 | "@mdx-js/loader": "^2.1.5", 22 | "@mdx-js/react": "^2.1.5", 23 | "@next/bundle-analyzer": "^13.0.6", 24 | "@next/mdx": "^13.0.6", 25 | "@tailwindcss/typography": "^0.5.8", 26 | "@types/ali-oss": "^6.16.7", 27 | "@types/cookie": "^0.5.1", 28 | "@types/cookie-parser": "^1.4.3", 29 | "@types/js-cookie": "^3.0.2", 30 | "@types/koa": "^2.13.5", 31 | "@types/koa-router": "^7.4.4", 32 | "@types/koa__cors": "^3.3.0", 33 | "@types/node": "^18.11.14", 34 | "@types/react": "^18.0.26", 35 | "@types/react-helmet": "^6.1.6", 36 | "ali-oss": "^6.17.1", 37 | "autoprefixer": "^10.4.13", 38 | "classnames": "^2.3.2", 39 | "cookie": "^0.5.0", 40 | "cookie-parser": "^1.4.6", 41 | "express": "^4.18.2", 42 | "js-cookie": "^3.0.1", 43 | "koa": "^2.14.1", 44 | "koa-body": "^6.0.1", 45 | "koa-router": "^12.0.0", 46 | "lodash": "^4.17.21", 47 | "midash": "^0.6.2", 48 | "next": "^13.0.6", 49 | "next-sitemap": "^3.1.32", 50 | "nodemon": "^2.0.20", 51 | "postcss": "^8.4.20", 52 | "postcss-flexbugs-fixes": "^5.0.2", 53 | "postcss-preset-env": "^7.8.3", 54 | "react": "^18.2.0", 55 | "react-dom": "^18.2.0", 56 | "react-ga": "^3.3.1", 57 | "react-helmet": "^6.1.0", 58 | "remark-frontmatter": "^4.0.1", 59 | "remark-mdx-frontmatter": "^2.1.1", 60 | "styled-jsx-plugin-postcss": "^4.0.1", 61 | "tailwindcss": "^3.2.4", 62 | "ts-node": "^10.9.1", 63 | "typescript": "^4.9.4" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /pages/100.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 1 3 | code: 100 4 | title: Continue 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.Continue" 7 | "Rust HTTP Status Constant": "http::StatusCode::CONTINUE" 8 | "Rails HTTP Status Symbol": ":continue" 9 | "Go HTTP Status Constant": "http.StatusContinue" 10 | "Symfony HTTP Status Constant": "Response::HTTP_CONTINUE" 11 | "Python2 HTTP Status Constant": "httplib.CONTINUE" 12 | "Python3+ HTTP Status Constant": "http.client.CONTINUE" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.CONTINUE" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 目前为止一切正常,客户端应该继续请求,如果已完成请求则忽略。为了让服务器检查请求的首部,客户端必须在发送请求实体前,在初始化请求中发送 `Expect: 100-continue` 首部并接收 `100 Continue` 响应状态码。 20 | 21 | The initial part of a request has been received and has not yet been rejected by the server. The server intends to send a final response after the request has been fully received and acted upon. 22 | 23 | When the request contains an Expect header field that includes a 100-continue expectation, the 100 response indicates that the server wishes to receive the request payload body[1](#ref-1). The client ought to continue sending the request and discard the 100 response. 24 | 25 | If the request did not contain an Expect header field containing the 100-continue expectation, the client can simply discard this interim response. 26 | 27 | --- 28 | 29 | * 1 Expect [RFC7231 Section 5.1.1][2] 30 | * Source: [RFC7231 Section 6.1.1][1] 31 | 32 | [1]: 33 | [2]: 34 | -------------------------------------------------------------------------------- /pages/101.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 1 3 | code: 101 4 | title: Switching Protocols 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.SwitchingProtocols" 7 | "Rust HTTP Status Constant": "http::StatusCode::SWITCHING_PROTOCOLS" 8 | "Rails HTTP Status Symbol": ":switching_protocols" 9 | "Go HTTP Status Constant": "http.StatusSwitchingProtocols" 10 | "Symfony HTTP Status Constant": "Response::HTTP_SWITCHING_PROTOCOLS" 11 | "Python2 HTTP Status Constant": "httplib.SWITCHING_PROTOCOLS" 12 | "Python3+ HTTP Status Constant": "http.client.SWITCHING_PROTOCOLS" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.SWITCHING_PROTOCOLS" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 服务器应客户端升级协议的请求 `Upgrade` 请求头正在切换协议。服务器会发送一个 `Upgrade` 响应头来表明其正在切换过去的协议。 20 | 21 | The server understands and is willing to comply with the client's request, via the Upgrade header field[1](#ref-1), for a change in the application protocol being used on this connection. 22 | 23 | The server MUST generate an Upgrade header field in the response that indicates which protocol(s) will be switched to immediately after the empty line that terminates the 101 response. 24 | 25 | It is assumed that the server will only agree to switch protocols when it is advantageous to do so. For example, switching to a newer version of HTTP might be advantageous over older versions, and switching to a real-time, synchronous protocol might be advantageous when delivering resources that use such features. 26 | 27 | --- 28 | 29 | * 1 Upgrade [RFC7230 Section 6.7][2] 30 | * Source: [RFC7231 Section 6.2.2][1] 31 | 32 | [1]: 33 | [2]: 34 | -------------------------------------------------------------------------------- /pages/102.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 1 3 | code: 102 4 | title: Processing 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.Processing" 7 | "Rust HTTP Status Constant": "http::StatusCode::PROCESSING" 8 | "Rails HTTP Status Symbol": ":processing" 9 | "Symfony HTTP Status Constant": "Response::HTTP_PROCESSING" 10 | --- 11 | import CodeTitle from '../components/CodeTitle' 12 | 13 | 14 | 15 | An interim response used to inform the client that the server has accepted the complete request, but has not yet completed it. 16 | 17 | This status code SHOULD only be sent when the server has a reasonable expectation that the request will take significant time to complete. As guidance, if a method is taking longer than 20 seconds (a reasonable, but arbitrary value) to process the server SHOULD return a 102 (Processing) response. The server MUST send a final response after the request has been completed. 18 | 19 | Methods can potentially take a long period of time to process, especially methods that support the Depth header. In such cases the client may time-out the connection while waiting for a response. To prevent this the server may return a 102 Processing status code to indicate to the client that the server is still processing the method. 20 | 21 | --- 22 | 23 | * Source: [RFC2518 Section 10.1][1] 24 | 25 | [1]: 26 | -------------------------------------------------------------------------------- /pages/103.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 1 3 | code: 103 4 | title: Early Hints 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.EarlyHints" 7 | --- 8 | import CodeTitle from '../components/CodeTitle' 9 | 10 | 11 | 12 | 一般和 `Link` 一起使用,来允许用户在服务器还在准备响应数据的时候预加载一些资源。 13 | 14 | ### Early Hints 15 | 16 | This status code indicates to the client that the server is likely to send a final response with the header fields included in the informational response. 17 | 18 | Typically, a server will include the header fields sent in a 103 (Early Hints) response in the final response as well. However, there might be cases when this is not desirable, such as when the server learns that the header fields in the 103 (Early Hints) response are not correct before the final response is sent. 19 | 20 | A client can speculatively evaluate the header fields included in a 103 (Early Hints) response while waiting for the final response. For example, a client might recognize a Link header field value containing the relation type "preload" and start fetching the target resource. However, these header fields only provide hints to the client; they do not replace the header fields on the final response. 21 | 22 | Aside from performance optimizations, such evaluation of the 103 (Early Hints) response's header fields MUST NOT affect how the final response is processed. A client MUST NOT interpret the 103 (Early Hints) response header fields as if they applied to the informational response itself (e.g., as metadata about the 103 (Early Hints) response). 23 | 24 | A server MAY use a 103 (Early Hints) response to indicate only some of the header fields that are expected to be found in the final response. A client SHOULD NOT interpret the nonexistence of a header field in a 103 (Early Hints) response as a speculation that the header field is unlikely to be part of the final response. 25 | 26 | ### Checkpoint 27 | 28 | This code is the same as [308 Resume Incomplete](/308#resume-incomplete) except for the fact that it is sent 29 | as a provisional response rather than a final response. 30 | In other words, zero or more 103 responses can be sent in response to a request 31 | that is still being processed, after which a final response code must be sent. 32 | 33 | --- 34 | 35 | * Source for Early Hints: [RFC8297 Section 2][1] 36 | 37 | [1]: 38 | -------------------------------------------------------------------------------- /pages/200.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 2 3 | code: 200 4 | title: OK 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.OK" 7 | "Rust HTTP Status Constant": "http::StatusCode::OK" 8 | "Rails HTTP Status Symbol": ":ok" 9 | "Go HTTP Status Constant": "http.StatusOK" 10 | "Symfony HTTP Status Constant": "Response::HTTP_OK" 11 | "Python2 HTTP Status Constant": "httplib.OK" 12 | "Python3+ HTTP Status Constant": "http.client.OK" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.OK" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 请求已经成功。默认情况下状态码为 200 的响应可以被缓存。 20 | 21 | The request has succeeded. 22 | 23 | The payload sent in a 200 response depends on the request method. For the methods defined by this specification, the intended meaning of the payload can be summarized as: 24 | 25 | * `GET` a representation of the target resource 26 | * `HEAD` the same representation as `GET`, but without the representation data 27 | * `POST` a representation of the status of, or results obtained from, the action; 28 | * `PUT` `DELETE` a representation of the status of the action; 29 | * `OPTIONS` a representation of the communications options; 30 | * `TRACE` a representation of the request message as received by the end server. 31 | 32 | Aside from responses to CONNECT, a 200 response always has a payload, though an origin server MAY generate a payload body of zero length. If no payload is desired, an origin server ought to send [204 No Content](/204) instead. For CONNECT, no payload is allowed because the successful result is a tunnel, which begins immediately after the 200 response header section. 33 | 34 | A 200 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls[1](#ref-1). 35 | 36 | --- 37 | 38 | * 1 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][2] 39 | * Source: [RFC7231 Section 6.3.1][1] 40 | 41 | [1]: 42 | [2]: 43 | -------------------------------------------------------------------------------- /pages/201.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 2 3 | code: 201 4 | title: Created 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.Created" 7 | "Rust HTTP Status Constant": "http::StatusCode::CREATED" 8 | "Rails HTTP Status Symbol": ":created" 9 | "Go HTTP Status Constant": "http.StatusCreated" 10 | "Symfony HTTP Status Constant": "Response::HTTP_CREATED" 11 | "Python2 HTTP Status Constant": "httplib.CREATED" 12 | "Python3+ HTTP Status Constant": "http.client.CREATED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.CREATED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 请求已经被成功处理,并且创建了新的资源。新的资源在应答返回之前已经被创建。同时新增的资源会在应答消息体中返回,其地址或者是原始请求的路径,或者是 `Location` 首部的值。 20 | 21 | The request has been fulfilled and has resulted in one or more new resources being created. 22 | 23 | The primary resource created by the request is identified by either a Location header field in the response or, if no Location field is received, by the effective request URI. 24 | 25 | The 201 response payload typically describes and links to the resource(s) created. See [Section 7.2 of RFC7231][2] for a discussion of the meaning and purpose of validator header fields, such as ETag and Last-Modified, in a 201 response. 26 | 27 | --- 28 | 29 | * Source: [RFC7231 Section 6.3.2][1] 30 | 31 | [1]: 32 | [2]: 33 | -------------------------------------------------------------------------------- /pages/202.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 2 3 | code: 202 4 | title: Accepted 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.Accepted" 7 | "Rust HTTP Status Constant": "http::StatusCode::ACCEPTED" 8 | "Rails HTTP Status Symbol": ":accepted" 9 | "Go HTTP Status Constant": "http.StatusAccepted" 10 | "Symfony HTTP Status Constant": "Response::HTTP_ACCEPTED" 11 | "Python2 HTTP Status Constant": "httplib.ACCEPTED" 12 | "Python3+ HTTP Status Constant": "http.client.ACCEPTED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.ACCEPTED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 请求已被接受并进行处理,但处理尚未完成,请求最终可能会被处理,也可能不会被处理。这个状态码被设计用来将请求交由另外一个进程或者服务器来进行处理,或者是对请求进行批处理的情形。 20 | 21 | The request has been accepted for processing, but the processing has not been 22 | completed. The request might or might not eventually be acted upon, as it might 23 | be disallowed when processing actually takes place. 24 | 25 | There is no facility in HTTP for re-sending a status code from an asynchronous 26 | operation. 27 | 28 | The 202 response is intentionally noncommittal. Its purpose is to allow a server to accept a request for some other process (perhaps a batch-oriented process that is only run once per day) without requiring that the user agent's connection to the server persist until the process is completed. The representation sent with this response ought to describe the request's current status and point to (or embed) a status monitor that can provide the user with an estimate of when the request will be fulfilled. 29 | 30 | --- 31 | 32 | * Source: [RFC7231 Section 6.3.3][1] 33 | 34 | [1]: 35 | -------------------------------------------------------------------------------- /pages/203.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 2 3 | code: 203 4 | title: Non-authoritative Information 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.NonAuthoritativeInformation" 7 | "Rust HTTP Status Constant": "http::StatusCode::NON_AUTHORITATIVE_INFORMATION" 8 | "Rails HTTP Status Symbol": ":non_authoritative_information" 9 | "Go HTTP Status Constant": "http.StatusNonAuthoritativeInfo" 10 | "Symfony HTTP Status Constant": "Response::HTTP_NON_AUTHORITATIVE_INFORMATION" 11 | "Python2 HTTP Status Constant": "httplib.NON_AUTHORITATIVE_INFORMATION" 12 | "Python3+ HTTP Status Constant": "http.client.NON_AUTHORITATIVE_INFORMATION" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.NON_AUTHORITATIVE_INFORMATION" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 请求已经成功被响应,但是获得的负载与源头服务器的状态码为 200 (OK) 的响应相比,经过了拥有转换功能的 proxy(代理服务器)的修改。 20 | 21 | The request was successful but the enclosed payload has been modified from that of the origin server's [200 OK](/200) response by a transforming proxy[1](#ref-1). 22 | 23 | This status code allows the proxy to notify recipients when a transformation has been applied, since that knowledge might impact later decisions regarding the content. For example, future cache validation requests for the content might only be applicable along the same request path (through the same proxies). 24 | 25 | The 203 response is similar to the Warning code of 214 Transformation Applied[2](#ref-2), which has the advantage of being applicable to responses with any status code. 26 | 27 | A 203 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls[3](#ref-3). 28 | 29 | --- 30 | 31 | * 1 Transformations [RFC7230 Section 5.7.2][2] 32 | * 2 Warning [RFC7234 Section 5.5][3] 33 | * 3 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][4] 34 | * Source: [RFC7231 Section 6.3.4][1] 35 | 36 | [1]: 37 | [2]: 38 | [3]: 39 | [4]: 40 | -------------------------------------------------------------------------------- /pages/204.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 2 3 | code: 204 4 | title: No Content 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.NoContent" 7 | "Rust HTTP Status Constant": "http::StatusCode::NO_CONTENT" 8 | "Rails HTTP Status Symbol": ":no_content" 9 | "Go HTTP Status Constant": "http.StatusNoContent" 10 | "Symfony HTTP Status Constant": "Response::HTTP_NO_CONTENT" 11 | "Python2 HTTP Status Constant": "httplib.NO_CONTENT" 12 | "Python3+ HTTP Status Constant": "http.client.NO_CONTENT" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.NO_CONTENT" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 请求已经成功,但客户端不需要内容。 20 | 21 | The server has successfully fulfilled the request and that there is no additional content to send in the response payload body. 22 | 23 | Metadata in the response header fields refer to the target resource and its selected representation after the requested action was applied. 24 | 25 | For example, if a 204 status code is received in response to a PUT request and the response contains an ETag header field, then the PUT was successful and the ETag field-value contains the entity-tag for the new representation of that target resource. 26 | 27 | The 204 response allows a server to indicate that the action has been successfully applied to the target resource, while implying that the user agent does not need to traverse away from its current "document view" (if any). The server assumes that the user agent will provide some indication of the success to its user, in accord with its own interface, and apply any new or updated metadata in the response to its active representation. 28 | 29 | For example, a 204 status code is commonly used with document editing interfaces corresponding to a "save" action, such that the document being saved remains available to the user for editing. It is also frequently used with interfaces that expect automated data transfers to be prevalent, such as within distributed version control systems. 30 | 31 | A 204 response is terminated by the first empty line after the header fields because it cannot contain a message body. 32 | 33 | A 204 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls[1](#ref-1). 34 | 35 | --- 36 | 37 | * 1 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][2] 38 | * Source: [RFC7231 Section 6.3.5][1] 39 | 40 | [1]: 41 | [2]: 42 | -------------------------------------------------------------------------------- /pages/205.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 2 3 | code: 205 4 | title: Reset Content 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.ResetContent" 7 | "Rust HTTP Status Constant": "http::StatusCode::RESET_CONTENT" 8 | "Rails HTTP Status Symbol": ":reset_content" 9 | "Go HTTP Status Constant": "http.StatusResetContent" 10 | "Symfony HTTP Status Constant": "Response::HTTP_RESET_CONTENT" 11 | "Python2 HTTP Status Constant": "httplib.RESET_CONTENT" 12 | "Python3+ HTTP Status Constant": "http.client.RESET_CONTENT" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.RESET_CONTENT" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 通知客户端重置文档视图,比如清空表单内容、重置 canvas 状态或者刷新用户界面。 20 | 21 | The server has fulfilled the request and desires that the user agent reset the "document view", which caused the request to be sent, to its original state as received from the origin server. 22 | 23 | This response is intended to support a common data entry use case where the user receives content that supports data entry (a form, notepad, canvas, etc.), enters or manipulates data in that space, causes the entered data to be submitted in a request, and then the data entry mechanism is reset for the next entry so that the user can easily initiate another input action. 24 | 25 | Since the 205 status code implies that no additional content will be provided, a server MUST NOT generate a payload in a 205 response. In other words, a server MUST do one of the following for a 205 response: a) indicate a zero-length body for the response by including a Content-Length header field with a value of 0; b) indicate a zero-length payload for the response by including a Transfer-Encoding header field with a value of chunked and a message body consisting of a single chunk of zero-length; or, c) close the connection immediately after sending the blank line terminating the header section. 26 | 27 | --- 28 | 29 | * Source: [RFC7231 Section 6.3.6][1] 30 | 31 | [1]: 32 | -------------------------------------------------------------------------------- /pages/206.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 2 3 | code: 206 4 | title: Partial Content 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.PartialContent" 7 | "Rust HTTP Status Constant": "http::StatusCode::PARTIAL_CONTENT" 8 | "Rails HTTP Status Symbol": ":partial_content" 9 | "Go HTTP Status Constant": "http.StatusPartialContent" 10 | "Symfony HTTP Status Constant": "Response::HTTP_PARTIAL_CONTENT" 11 | "Python2 HTTP Status Constant": "httplib.PARTIAL_CONTENT" 12 | "Python3+ HTTP Status Constant": "http.client.PARTIAL_CONTENT" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.PARTIAL_CONTENT" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 请求已成功,并且主体包含所请求的数据区间,该数据区间是在请求的 `Range` 首部指定的。 20 | 21 | The server is successfully fulfilling a range request for the target resource by transferring one or more parts of the selected representation that correspond to the satisfiable ranges found in the request's Range header field[1](#ref-1). 22 | 23 | If a single part is being transferred, the server generating the 206 response MUST generate a Content-Range header field, describing what range of the selected representation is enclosed, and a payload consisting of the range. For example: 24 | 25 | ``` 26 | HTTP/1.1 206 Partial Content 27 | Date: Wed, 15 Nov 1995 06:25:24 GMT 28 | Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT 29 | Content-Range: bytes 21010-47021/47022 30 | Content-Length: 26012 31 | Content-Type: image/gif 32 | 33 | ... 26012 bytes of partial image data ... 34 | ``` 35 | 36 | If multiple parts are being transferred, the server generating the 206 response MUST generate a "multipart/byteranges" payload[2](#ref-2), and a Content-Type header field containing the multipart/byteranges media type and its required boundary parameter. To avoid confusion with single-part responses, a server MUST NOT generate a Content-Range header field in the HTTP header section of a multiple part response (this field will be sent in each part instead). 37 | 38 | Within the header area of each body part in the multipart payload, the server MUST generate a Content-Range header field corresponding to the range being enclosed in that body part. If the selected representation would have had a Content-Type header field in a [200 OK](/200) response, the server SHOULD generate that same Content-Type field in the header area of each body part. For example: 39 | 40 | ``` 41 | HTTP/1.1 206 Partial Content 42 | Date: Wed, 15 Nov 1995 06:25:24 GMT 43 | Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT 44 | Content-Length: 1741 45 | Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES 46 | 47 | --THIS_STRING_SEPARATES 48 | Content-Type: application/pdf 49 | Content-Range: bytes 500-999/8000 50 | 51 | ...the first range... 52 | --THIS_STRING_SEPARATES 53 | Content-Type: application/pdf 54 | Content-Range: bytes 7000-7999/8000 55 | 56 | ...the second range 57 | --THIS_STRING_SEPARATES-- 58 | ``` 59 | 60 | When multiple ranges are requested, a server MAY coalesce any of the ranges that overlap, or that are separated by a gap that is smaller than the overhead of sending multiple parts, regardless of the order in which the corresponding byte-range-spec appeared in the received Range header field. Since the typical overhead between parts of a multipart/byteranges payload is around 80 bytes, depending on the selected representation's media type and the chosen boundary parameter length, it can be less efficient to transfer many small disjoint parts than it is to transfer the entire selected representation. 61 | 62 | A server MUST NOT generate a multipart response to a request for a single range, since a client that does not request multiple parts might not support multipart responses. However, a server MAY generate a multipart/byteranges payload with only a single body part if multiple ranges were requested and only one range was found to be satisfiable or only one range remained after coalescing. A client that cannot process a multipart/byteranges response MUST NOT generate a request that asks for multiple ranges. 63 | 64 | When a multipart response payload is generated, the server SHOULD send the parts in the same order that the corresponding byte-range-spec appeared in the received Range header field, excluding those ranges that were deemed unsatisfiable or that were coalesced into other ranges. A client that receives a multipart response MUST inspect the Content-Range header field present in each body part in order to determine which range is contained in that body part; a client cannot rely on receiving the same ranges that it requested, nor the same order that it requested. 65 | 66 | When a 206 response is generated, the server MUST generate the following header fields, in addition to those required above, if the field would have been sent in a [200 OK](/200) response to the same request: Date, Cache-Control, ETag, Expires, Content-Location, and Vary. 67 | 68 | If a 206 is generated in response to a request with an If-Range header field, the sender SHOULD NOT generate other representation header fields beyond those required above, because the client is understood to already have a prior response containing those header fields. Otherwise, the sender MUST generate all of the representation header fields that would have been sent in a [200 OK](/200) response to the same request. 69 | 70 | A 206 response is cacheable by default; i.e., unless otherwise indicated by explicit cache controls[3](#ref-3). 71 | 72 | --- 73 | 74 | * 1 Range [RFC7233 Section 3.1][2] 75 | * 2 Internet Media Type multipart/byteranges [RFC7233 Appendix A][3] 76 | * 3 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][4] 77 | * Source: [RFC7233 Section 4.1][1] 78 | 79 | [1]: 80 | [2]: 81 | [3]: 82 | [4]: 83 | -------------------------------------------------------------------------------- /pages/207.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 2 3 | code: 207 4 | title: Multi-Status 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.MultiStatus" 7 | "Rust HTTP Status Constant": "http::StatusCode::MULTI_STATUS" 8 | "Rails HTTP Status Symbol": ":multi_status" 9 | "Symfony HTTP Status Constant": "Response::HTTP_MULTI_STATUS" 10 | --- 11 | import CodeTitle from '../components/CodeTitle' 12 | 13 | 14 | 15 | A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate. 16 | 17 | The default Multi-Status response body is a text/xml or application/xml HTTP entity with a 'multistatus' root element. Further elements contain 200, 300, 400, and 500 series status codes generated during the method invocation. 100 series status codes SHOULD NOT be recorded in a 'response' XML element. 18 | 19 | Although '207' is used as the overall response status code, the recipient needs to consult the contents of the multistatus response body for further information about the success or failure of the method execution. The response MAY be used in success, partial success and also in failure situations. 20 | 21 | The 'multistatus' root element holds zero or more 'response' elements in any order, each with information about an individual resource. Each 'response' element MUST have an 'href' element to identify the resource. 22 | 23 | A Multi-Status response uses one out of two distinct formats for representing the status: 24 | 25 | 1\. A 'status' element as child of the 'response' element indicates the status of the message execution for the identified resource as a whole[1](#ref-1). Some method definitions provide information about specific status codes clients should be prepared to see in a response. However, clients MUST be able to handle other status codes, using the generic rules defined in [RFC2616 Section 10][3]. 26 | 27 | 2\. For PROPFIND and PROPPATCH, the format has been extended using the 'propstat' element instead of 'status', providing information about individual properties of a resource. This format is specific to PROPFIND and PROPPATCH, and is described in detail in [RFC4918 Section 9.1][4] and [RFC4918 Section 9.2][5]. 28 | 29 | --- 30 | 31 | * 1 Example - DELETE [RFC4918 Section 9.6.2][2] 32 | * Source: [RFC4918 Section 13][1] 33 | 34 | [1]: 35 | [2]: 36 | [3]: 37 | [4]: 38 | [5]: 39 | -------------------------------------------------------------------------------- /pages/208.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 2 3 | code: 208 4 | title: Already Reported 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.AlreadyReported" 7 | "Rust HTTP Status Constant": "http::StatusCode::ALREADY_REPORTED" 8 | "Symfony HTTP Status Constant": "Response::HTTP_ALREADY_REPORTED" 9 | --- 10 | import CodeTitle from '../components/CodeTitle' 11 | 12 | 13 | 14 | Used inside a DAV: propstat response element to avoid enumerating the internal members of multiple bindings to the same collection repeatedly. 15 | 16 | For each binding to a collection inside the request's scope, only one will be reported with a 200 status, while subsequent DAV:response elements for all other bindings will use the 208 status, and no DAV:response elements for their descendants are included. 17 | 18 | Note that the 208 status will only occur for "Depth: infinity" requests, and that it is of particular importance when the multiple collection bindings cause a bind loop[1](#ref-1). 19 | 20 | A client can request the DAV:resource-id property in a PROPFIND request to guarantee that they can accurately reconstruct the binding structure of a collection with multiple bindings to a single resource. 21 | 22 | For backward compatibility with clients not aware of the 208 status code appearing in multistatus response bodies, it SHOULD NOT be used unless the client has signaled support for this specification using the "DAV" request header[2](#ref-2). Instead, a [508 Loop Detected](/508) status should be returned when a binding loop is discovered. This allows the server to return the 508 as the top-level return status, if it discovers it before it started the response, or in the middle of a multistatus, if it discovers it in the middle of streaming out a multistatus response. 23 | 24 | --- 25 | 26 | * 1 URI Mappings Created by a New Binding [RFC5842 Section 2.2][2] 27 | * 2 'DAV' Request Header [RFC5842 Section 8.2][3] 28 | * Source: [RFC5842 Section 7.1][1] 29 | 30 | [1]: 31 | [2]: 32 | [3]: 33 | -------------------------------------------------------------------------------- /pages/226.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 2 3 | code: 226 4 | title: IM Used 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.IMUsed" 7 | "Rust HTTP Status Constant": "http::StatusCode::IM_USED" 8 | "Rails HTTP Status Symbol": ":im_used" 9 | "Symfony HTTP Status Constant": "Response::HTTP_IM_USED" 10 | --- 11 | import CodeTitle from '../components/CodeTitle' 12 | 13 | 14 | 15 | The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance. 16 | 17 | The actual current instance might not be available except by combining this response with other previous or future responses, as appropriate for the specific instance-manipulation(s). If so, the headers of the resulting instance are the result of combining the headers from the 226 response and the other instances, following the rules in [section 13.5.3][2] of the HTTP/1.1 specification. 18 | 19 | The request MUST have included an A-IM header field listing at least one instance-manipulation. The response MUST include an Etag header field giving the entity tag of the current instance. 20 | 21 | A response received with a status code of 226 MAY be stored by a cache and used in reply to a subsequent request, subject to the HTTP expiration mechanism and any Cache-Control headers, and to the requirements in [section 10.6][3]. 22 | 23 | A response received with a status code of 226 MAY be used by a cache, in conjunction with a cache entry for the base instance, to create a cache entry for the current instance. 24 | 25 | --- 26 | 27 | * Source: [RFC3229 Section 10.4.1][1] 28 | 29 | [1]: 30 | [2]: 31 | [3]: 32 | -------------------------------------------------------------------------------- /pages/300.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 3 3 | code: 300 4 | title: Multiple Choices 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.MultipleChoices" 7 | "Rust HTTP Status Constant": "http::StatusCode::MULTIPLE_CHOICES" 8 | "Rails HTTP Status Symbol": ":multiple_choices" 9 | "Go HTTP Status Constant": "http.StatusMultipleChoices" 10 | "Symfony HTTP Status Constant": "Response::HTTP_MULTIPLE_CHOICES" 11 | "Python2 HTTP Status Constant": "httplib.MULTIPLE_CHOICES" 12 | "Python3+ HTTP Status Constant": "http.client.MULTIPLE_CHOICES" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.MULTIPLE_CHOICES" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 该请求拥有多种可能的响应。用户代理或者用户自身应该从中选择一个。由于没有如何进行选择的标准方法,这个状态码极少使用。 20 | 21 | The target resource has more than one representation, each with its own more specific identifier, and information about the alternatives is being provided so that the user (or user agent) can select a preferred representation by redirecting its request to one or more of those identifiers. 22 | 23 | In other words, the server desires that the user agent engage in reactive negotiation to select the most appropriate representation(s) for its needs[1](#ref-1). 24 | 25 | If the server has a preferred choice, the server SHOULD generate a Location header field containing a preferred choice's URI reference. The user agent MAY use the Location field value for automatic redirection. 26 | 27 | For request methods other than HEAD, the server SHOULD generate a payload in the 300 response containing a list of representation metadata and URI reference(s) from which the user or user agent can choose the one most preferred. The user agent MAY make a selection from that list automatically if it understands the provided media type. A specific format for automatic selection is not defined by this specification because HTTP tries to remain orthogonal to the definition of its payloads. In practice, the representation is provided in some easily parsed format believed to be acceptable to the user agent, as determined by shared design or content negotiation, or in some commonly accepted hypertext format. 28 | 29 | A 300 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls[2](#ref-2). 30 | 31 | Note: The original proposal for the 300 status code defined the URI header field as providing a list of alternative representations, such that it would be usable for 200, 300, and 406 responses and be transferred in responses to the HEAD method. However, lack of deployment and disagreement over syntax led to both URI and Alternates (a subsequent proposal) being dropped from this specification. It is possible to communicate the list using a set of Link header fields[3](#ref-3), each with a relationship of "alternate", though deployment is a chicken-and-egg problem. 32 | 33 | --- 34 | 35 | * 1 Content Negotiation [RFC7231 Section 3.4][2] 36 | * 2 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][3] 37 | * 3 Web Linking [RFC5988][4] 38 | * Source: [RFC7231 Section 6.4.1][1] 39 | 40 | [1]: 41 | [2]: 42 | [3]: 43 | [4]: 44 | -------------------------------------------------------------------------------- /pages/301.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 3 3 | code: 301 4 | title: Moved Permanently 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.MovedPermanently" 7 | "Rust HTTP Status Constant": "http::StatusCode::MOVED_PERMANENTLY" 8 | "Rails HTTP Status Symbol": ":moved_permanently" 9 | "Go HTTP Status Constant": "http.StatusMovedPermanently" 10 | "Symfony HTTP Status Constant": "Response::HTTP_MOVED_PERMANENTLY" 11 | "Python2 HTTP Status Constant": "httplib.MOVED_PERMANENTLY" 12 | "Python3+ HTTP Status Constant": "http.client.MOVED_PERMANENTLY" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.MOVED_PERMANENTLY" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 请求的资源已经被移动到了由 `Location` 头部指定的 url 上,是固定的不会再改变。搜索引擎会根据该响应修正。 20 | 21 | The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs. 22 | 23 | Clients with link-editing capabilities ought to automatically re-link references to the effective request URI to one or more of the new references sent by the server, where possible. 24 | 25 | The server SHOULD generate a Location header field in the response containing a preferred URI reference for the new permanent URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the new URI(s). 26 | 27 | Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. If this behavior is undesired, the [307 Temporary Redirect](/307) status code can be used instead. 28 | 29 | A 301 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls[1](#ref-1). 30 | 31 | --- 32 | 33 | * 1 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][2] 34 | * Source: [RFC7231 Section 6.4.2][1] 35 | 36 | [1]: 37 | [2]: 38 | -------------------------------------------------------------------------------- /pages/302.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 3 3 | code: 302 4 | title: Found 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.Found" 7 | "Rust HTTP Status Constant": "http::StatusCode::FOUND" 8 | "Rails HTTP Status Symbol": ":found" 9 | "Go HTTP Status Constant": "http.StatusFound" 10 | "Symfony HTTP Status Constant": "Response::HTTP_FOUND" 11 | "Python2 HTTP Status Constant": "httplib.FOUND" 12 | "Python3+ HTTP Status Constant": "http.client.FOUND" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.FOUND" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 请求的资源被暂时的移动到了由该 HTTP 响应的响应头 `Location` 指定的 URL 上。浏览器会重定向到这个 URL,但是搜索引擎不会对该资源的链接进行更新。 20 | 21 | The target resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client ought to continue to use the effective request URI for future requests. 22 | 23 | The server SHOULD generate a Location header field in the response containing a URI reference for the different URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the different URI(s). 24 | 25 | Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. If this behavior is undesired, the [307 Temporary Redirect](/307) status code can be used instead. 26 | 27 | --- 28 | 29 | * Source: [RFC7231 Section 6.4.3][1] 30 | 31 | [1]: 32 | -------------------------------------------------------------------------------- /pages/303.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 3 3 | code: 303 4 | title: See Other 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.SeeOther" 7 | "Rust HTTP Status Constant": "http::StatusCode::SEE_OTHER" 8 | "Rails HTTP Status Symbol": ":see_other" 9 | "Go HTTP Status Constant": "http.StatusSeeOther" 10 | "Symfony HTTP Status Constant": "Response::HTTP_SEE_OTHER" 11 | "Python2 HTTP Status Constant": "httplib.SEE_OTHER" 12 | "Python3+ HTTP Status Constant": "http.client.SEE_OTHER" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.SEE_OTHER" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 通常作为 `PUT` 或 `POST` 操作的返回结果,它表示重定向链接指向的不是新上传的资源,而是另外一个页面,比如消息确认页面或上传进度页面。而请求重定向页面的方法要总是使用 GET。 20 | 21 | The server is redirecting the user agent to a different resource, as indicated by a URI in the Location header field, which is intended to provide an indirect response to the original request. 22 | 23 | A user agent can perform a retrieval request targeting that URI (a GET or HEAD request if using HTTP), which might also be redirected, and present the eventual result as an answer to the original request. Note that the new URI in the Location header field is not considered equivalent to the effective request URI. 24 | 25 | This status code is applicable to any HTTP method. It is primarily used to allow the output of a POST action to redirect the user agent to a selected resource, since doing so provides the information corresponding to the POST response in a form that can be separately identified, bookmarked, and cached, independent of the original request. 26 | 27 | A 303 response to a GET request indicates that the origin server does not have a representation of the target resource that can be transferred by the server over HTTP. However, the Location field value refers to a resource that is descriptive of the target resource, such that making a retrieval request on that other resource might result in a representation that is useful to recipients without implying that it represents the original target resource. Note that answers to the questions of what can be represented, what representations are adequate, and what might be a useful description are outside the scope of HTTP. 28 | 29 | Except for responses to a HEAD request, the representation of a 303 response ought to contain a short hypertext note with a hyperlink to the same URI reference provided in the Location header field. 30 | 31 | --- 32 | 33 | * Source: [RFC7321 Section 6.4.4][1] 34 | 35 | [1]: 36 | -------------------------------------------------------------------------------- /pages/304.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 3 3 | code: 304 4 | title: Not Modified 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.NotModified" 7 | "Rust HTTP Status Constant": "http::StatusCode::NOT_MODIFIED" 8 | "Rails HTTP Status Symbol": ":not_modified" 9 | "Go HTTP Status Constant": "http.StatusNotModified" 10 | "Symfony HTTP Status Constant": "Response::HTTP_NOT_MODIFIED" 11 | "Python2 HTTP Status Constant": "httplib.NOT_MODIFIED" 12 | "Python3+ HTTP Status Constant": "http.client.NOT_MODIFIED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.NOT_MODIFIED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 无需再次传输请求的内容,也就是说可以使用缓存的内容。 20 | 21 | A conditional GET or HEAD request has been received and would have resulted in a [200 OK](/200) response if it were not for the fact that the condition evaluated to false. 22 | 23 | In other words, there is no need for the server to transfer a representation of the target resource because the request indicates that the client, which made the request conditional, already has a valid representation; the server is therefore redirecting the client to make use of that stored representation as if it were the payload of a [200 OK](/200) response. 24 | 25 | The server generating a 304 response MUST generate any of the following header fields that would have been sent in a [200 OK](/200) response to the same request: Cache-Control, Content-Location, Date, ETag, Expires, and Vary. 26 | 27 | Since the goal of a 304 response is to minimize information transfer when the recipient already has one or more cached representations, a sender SHOULD NOT generate representation metadata other than the above listed fields unless said metadata exists for the purpose of guiding cache updates (e.g., Last-Modified might be useful if the response does not have an ETag field). 28 | 29 | Requirements on a cache that receives a 304 response are defined in [Section 4.3.4 of RFC7234][2]. If the conditional request originated with an outbound client, such as a user agent with its own cache sending a conditional GET to a shared proxy, then the proxy SHOULD forward the 304 response to that client. 30 | 31 | A 304 response cannot contain a message-body; it is always terminated by the first empty line after the header fields. 32 | 33 | --- 34 | 35 | * Source: [RFC7232 Section 4.1][1] 36 | 37 | [1]: 38 | [2]: 39 | -------------------------------------------------------------------------------- /pages/305.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 3 3 | code: 305 4 | title: Use Proxy 5 | #references: 6 | # ".NET HTTP Status Enum": "HttpStatusCode.UseProxy" 7 | # "Rust HTTP Status Constant": "http::StatusCode::USE_PROXY" 8 | # "Rails HTTP Status Symbol": "use_proxy" 9 | # "Go HTTP Status Constant": "http.StatusUseProxy" 10 | # "Symfony HTTP Status Constant": "Response::HTTP_USE_PROXY" 11 | # "Python2 HTTP Status Constant": "httplib.USE_PROXY" 12 | # "Python3+ HTTP Status Constant": "http.client.USE_PROXY" 13 | # "Python3.5+ HTTP Status Constant": "http.HTTPStatus.USE_PROXY" 14 | # - Due to deprecation we won't show this... but should we? 15 | --- 16 | import CodeTitle from '../components/CodeTitle' 17 | 18 | 19 | 20 | Defined in a previous version of this specification and is now deprecated, due to security concerns regarding in-band configuration of a proxy. 21 | 22 | --- 23 | 24 | * Source: [RFC7231 Section 6.4.5][1] 25 | 26 | [1]: 27 | -------------------------------------------------------------------------------- /pages/307.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 3 3 | code: 307 4 | title: Temporary Redirect 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.TemporaryRedirect" 7 | "Rust HTTP Status Constant": "http::StatusCode::TEMPORARY_REDIRECT" 8 | "Rails HTTP Status Symbol": ":temporary_redirect" 9 | "Go HTTP Status Constant": "http.StatusTemporaryRedirect" 10 | "Symfony HTTP Status Constant": "Response::HTTP_TEMPORARY_REDIRECT" 11 | "Python2 HTTP Status Constant": "httplib.TEMPORARY_REDIRECT" 12 | "Python3+ HTTP Status Constant": "http.client.TEMPORARY_REDIRECT" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.TEMPORARY_REDIRECT" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 临时重定向响应状态码,表示请求的资源暂时地被移动到了响应的 `Location` 首部所指向的 URL 上。 20 | 21 | The target resource resides temporarily under a different URI and the user agent MUST NOT change the request method if it performs an automatic redirection to that URI. 22 | 23 | Since the redirection can change over time, the client ought to continue using the original effective request URI for future requests. 24 | 25 | The server SHOULD generate a Location header field in the response containing a URI reference for the different URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the different URI(s). 26 | 27 | Note: This status code is similar to 302 Found, except that it does not allow changing the request method from POST to GET. This specification defines no equivalent counterpart for [301 Moved Permanently](/301) ([RFC7238][2], however, proposes defining the status code [308 Permanent Redirect](/308) for this purpose). 28 | 29 | --- 30 | 31 | * Source: [RFC7231 Section 6.4.7][1] 32 | 33 | [1]: 34 | [2]: 35 | -------------------------------------------------------------------------------- /pages/308.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 3 3 | code: 308 4 | title: Permanent Redirect 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.PermanentRedirect" 7 | "Rust HTTP Status Constant": "http::StatusCode::PERMANENT_REDIRECT" 8 | "Symfony HTTP Status Constant": "Response::HTTP_PERMANENTLY_REDIRECT" 9 | --- 10 | import CodeTitle from '../components/CodeTitle' 11 | 12 | 13 | 14 | 请求的资源已经被永久的移动到了由 `Location` 首部指定的 URL 上。浏览器会进行重定向,同时搜索引擎也会更新其链接。 15 | 16 | ### Permanent Redirect 17 | 18 | The target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs. 19 | 20 | Clients with link editing capabilities ought to automatically re-link references to the effective request URI[1](#ref-1) to one or more of the new references sent by the server, where possible. 21 | 22 | The server SHOULD generate a Location header field[2](#ref-2) in the response containing a preferred URI reference for the new permanent URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the new URI(s). 23 | 24 | A 308 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls[3](#ref-3). 25 | 26 | Note: This status code is similar to [301 Moved Permanently](/301), except that it does not allow changing the request method from POST to GET. 27 | 28 | ### Resume Incomplete 29 | 30 | Some applications may use 308 Resume Incomplete as a non-standard response. 31 | 32 | This status code indicates to the client that the server does not possess the 33 | complete byte range for the resume request to proceed but is still 34 | willing to continue the operation. 35 | It may include a Range header so that the client may minimize the amount 36 | of data that needs to be retransmitted by the ensuing resume requests. 37 | In the absence of any such Range header, the client should assume that 38 | the server has no stored bytes. 39 | It may include a Location header indicating the URI to which future 40 | resumable requests should be sent for this operation. 41 | 42 | --- 43 | 44 | * 1 Effective Request URI [RFC7230 Section 5.5][2] 45 | * 2 Location [RFC7231 Section 7.1.2][3] 46 | * 3 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][4] 47 | * Sources: 48 | * [RFC738 Section 3][1] 49 | * [Resumable HTTP requests](5) 50 | 51 | [1]: 52 | [2]: 53 | [3]: 54 | [4]: 55 | [5]: 56 | -------------------------------------------------------------------------------- /pages/400.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 400 4 | title: Bad Request 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.BadRequest" 7 | "Rust HTTP Status Constant": "http::StatusCode::BAD_REQUEST" 8 | "Rails HTTP Status Symbol": ":bad_request" 9 | "Go HTTP Status Constant": "http.StatusBadRequest" 10 | "Symfony HTTP Status Constant": "Response::HTTP_BAD_REQUEST" 11 | "Python2 HTTP Status Constant": "httplib.BAD_REQUEST" 12 | "Python3+ HTTP Status Constant": "http.client.BAD_REQUEST" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.BAD_REQUEST" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 由于语法无效,服务器无法理解该请求。 客户端不应该在未经修改的情况下重复此请求。 20 | 21 | The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). 22 | 23 | --- 24 | 25 | * Source: [RFC7231 Section 6.5.1][1] 26 | 27 | [1]: 28 | -------------------------------------------------------------------------------- /pages/401.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 401 4 | title: Unauthorized 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.Unauthorized" 7 | "Rust HTTP Status Constant": "http::StatusCode::UNAUTHORIZED" 8 | "Rails HTTP Status Symbol": ":unauthorized" 9 | "Go HTTP Status Constant": "http.StatusUnauthorized" 10 | "Symfony HTTP Status Constant": "Response::HTTP_UNAUTHORIZED" 11 | "Python2 HTTP Status Constant": "httplib.UNAUTHORIZED" 12 | "Python3+ HTTP Status Constant": "http.client.UNAUTHORIZED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.UNAUTHORIZED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 由于缺乏目标资源要求的身份验证凭证,发送的请求未得到满足。 20 | 21 | The request has not been applied because it lacks valid authentication credentials for the target resource. 22 | 23 | The server generating a 401 response MUST send a WWW-Authenticate header field[1](#ref-1) containing at least one challenge applicable to the target resource. 24 | 25 | If the request included authentication credentials, then the 401 response indicates that authorization has been refused for those credentials. The user agent MAY repeat the request with a new or replaced Authorization header field[2](#ref-2). If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user agent SHOULD present the enclosed representation to the user, since it usually contains relevant diagnostic information. 26 | 27 | --- 28 | 29 | * 1 WWW-Authenticate [RFC7235 Section 4.1][2] 30 | * 2 Authorization [RFC7235 Section 4.2][3] 31 | * Source: [RFC7235 Section 3.1][1] 32 | 33 | [1]: 34 | [2]: 35 | [3]: 36 | -------------------------------------------------------------------------------- /pages/402.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 402 4 | title: Payment Required 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.PaymentRequired" 7 | "Rust HTTP Status Constant": "http::StatusCode::PAYMENT_REQUIRED" 8 | "Rails HTTP Status Symbol": ":payment_required" 9 | "Go HTTP Status Constant": "http.StatusPaymentRequired" 10 | "Symfony HTTP Status Constant": "Response::HTTP_PAYMENT_REQUIRED" 11 | "Python2 HTTP Status Constant": "httplib.PAYMENT_REQUIRED" 12 | "Python3+ HTTP Status Constant": "http.client.PAYMENT_REQUIRED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.PAYMENT_REQUIRED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 一个被保留使用的非标准客户端错误状态响应码。 20 | 21 | Reserved for future use. 22 | 23 | --- 24 | 25 | * Source: [RFC7231 Section 6.5.2][1] 26 | 27 | [1]: 28 | -------------------------------------------------------------------------------- /pages/403.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 403 4 | title: Forbidden 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.Forbidden" 7 | "Rust HTTP Status Constant": "http::StatusCode::FORBIDDEN" 8 | "Rails HTTP Status Symbol": ":forbidden" 9 | "Go HTTP Status Constant": "http.StatusForbidden" 10 | "Symfony HTTP Status Constant": "Response::HTTP_FORBIDDEN" 11 | "Python2 HTTP Status Constant": "httplib.FORBIDDEN" 12 | "Python3+ HTTP Status Constant": "http.client.FORBIDDEN" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.FORBIDDEN" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 服务器端有能力处理该请求,但是拒绝授权访问。 20 | 21 | The server understood the request but refuses to authorize it. 22 | 23 | A server that wishes to make public why the request has been forbidden can describe that reason in the response payload (if any). 24 | 25 | If authentication credentials were provided in the request, the server considers them insufficient to grant access. The client SHOULD NOT automatically repeat the request with the same credentials. The client MAY repeat the request with new or different credentials. However, a request might be forbidden for reasons unrelated to the credentials. 26 | 27 | An origin server that wishes to "hide" the current existence of a forbidden target resource MAY instead respond with a status code of [404 Not Found](/404). 28 | 29 | --- 30 | 31 | * Source: [RFC7231 Section 6.5.3][1] 32 | 33 | [1]: 34 | -------------------------------------------------------------------------------- /pages/405.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 405 4 | title: Method Not Allowed 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.MethodNotAllowed" 7 | "Rust HTTP Status Constant": "http::StatusCode::METHOD_NOT_ALLOWED" 8 | "Rails HTTP Status Symbol": ":method_not_allowed" 9 | "Go HTTP Status Constant": "http.StatusMethodNotAllowed" 10 | "Symfony HTTP Status Constant": "Response::HTTP_METHOD_NOT_ALLOWED" 11 | "Python2 HTTP Status Constant": "httplib.METHOD_NOT_ALLOWED" 12 | "Python3+ HTTP Status Constant": "http.client.METHOD_NOT_ALLOWED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.METHOD_NOT_ALLOWED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 服务器禁止了使用当前 HTTP 方法的请求。 20 | 21 | The method received in the request-line is known by the origin server but not supported by the target resource. 22 | 23 | The origin server MUST generate an Allow header field in a 405 response containing a list of the target resource's currently supported methods. 24 | 25 | A 405 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls[1](#ref-1). 26 | 27 | --- 28 | 29 | * 1 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][2] 30 | * Source: [RFC7231 Section 6.5.5][1] 31 | 32 | [1]: 33 | [2]: 34 | -------------------------------------------------------------------------------- /pages/406.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 406 4 | title: Not Acceptable 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.NotAcceptable" 7 | "Rust HTTP Status Constant": "http::StatusCode::NOT_ACCEPTABLE" 8 | "Rails HTTP Status Symbol": ":not_acceptable" 9 | "Go HTTP Status Constant": "http.StatusNotAcceptable" 10 | "Symfony HTTP Status Constant": "Response::HTTP_NOT_ACCEPTABLE" 11 | "Python2 HTTP Status Constant": "httplib.NOT_ACCEPTABLE" 12 | "Python3+ HTTP Status Constant": "http.client.NOT_ACCEPTABLE" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.NOT_ACCEPTABLE" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 服务器端无法提供与 Accept-Charset 以及 Accept-Language 消息头指定的值相匹配的响应。 20 | 21 | The target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request[1](#ref-1), and the server is unwilling to supply a default representation. 22 | 23 | The server SHOULD generate a payload containing a list of available representation characteristics and corresponding resource identifiers from which the user or user agent can choose the one most appropriate. A user agent MAY automatically select the most appropriate choice from that list. However, this specification does not define any standard for such automatic selection, as described in [RFC7231 Section 6.4.1][3]. 24 | 25 | --- 26 | 27 | * 1 Content Negotiation [RFC7231 Section 5.3][2] 28 | * Source: [RFC7231 Section 6.5.6][1] 29 | 30 | [1]: 31 | [2]: 32 | [3]: 33 | -------------------------------------------------------------------------------- /pages/407.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 407 4 | title: Proxy Authentication Required 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.ProxyAuthenticationRequired" 7 | "Rust HTTP Status Constant": "http::StatusCode::PROXY_AUTHENTICATION_REQUIRED" 8 | "Rails HTTP Status Symbol": ":proxy_authentication_required" 9 | "Go HTTP Status Constant": "http.StatusProxyAuthRequired" 10 | "Symfony HTTP Status Constant": "Response::HTTP_PROXY_AUTHENTICATION_REQUIRED" 11 | "Python2 HTTP Status Constant": "httplib.PROXY_AUTHENTICATION_REQUIRED" 12 | "Python3+ HTTP Status Constant": "http.client.PROXY_AUTHENTICATION_REQUIRED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.PROXY_AUTHENTICATION_REQUIRED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 由于缺乏位于浏览器与可以访问所请求资源的服务器之间的代理服务器(proxy server )要求的身份验证凭证,发送的请求尚未得到满足。 20 | 21 | Similar to [401 Unauthorized](/401), but it indicates that the client needs to authenticate itself in order to use a proxy. 22 | 23 | The proxy MUST send a Proxy-Authenticate header field[1](#ref-1) containing a challenge applicable to that proxy for the target resource. The client MAY repeat the request with a new or replaced Proxy-Authorization header field[2](#ref-2). 24 | 25 | --- 26 | 27 | * 1 Proxy-Authenticate [RFC7235 Section 4.3][2] 28 | * 2 Proxy-Authorization [RFC7235 Section 4.4][3] 29 | * Source: [RFC7235 Section 3.2][1] 30 | 31 | [1]: 32 | [2]: 33 | [3]: 34 | -------------------------------------------------------------------------------- /pages/408.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 408 4 | title: Request Timeout 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.RequestTimeout" 7 | "Rust HTTP Status Constant": "http::StatusCode::REQUEST_TIMEOUT" 8 | "Rails HTTP Status Symbol": ":request_timeout" 9 | "Go HTTP Status Constant": "http.StatusRequestTimeout" 10 | "Symfony HTTP Status Constant": "Response::HTTP_REQUEST_TIMEOUT" 11 | "Python2 HTTP Status Constant": "httplib.REQUEST_TIMEOUT" 12 | "Python3+ HTTP Status Constant": "http.client.REQUEST_TIMEOUT" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.REQUEST_TIMEOUT" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 服务器想要将没有在使用的连接关闭。一些服务器会在空闲连接上发送此信息,即便是在客户端没有发送任何请求的情况下。 20 | 21 | The server did not receive a complete request message within the time that it was prepared to wait. 22 | 23 | A server SHOULD send the "close" connection option[1](#ref-1) in the response, since 408 implies that the server has decided to close the connection rather than continue waiting. If the client has an outstanding request in transit, the client MAY repeat that request on a new connection. 24 | 25 | --- 26 | 27 | * 1 Connection [RFC7230 Section 6.1][2] 28 | * Source: [RFC7231 Section 6.5.7][1] 29 | 30 | [1]: 31 | [2]: 32 | -------------------------------------------------------------------------------- /pages/409.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 409 4 | title: Conflict 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.Conflict" 7 | "Rust HTTP Status Constant": "http::StatusCode::CONFLICT" 8 | "Rails HTTP Status Symbol": ":conflict" 9 | "Go HTTP Status Constant": "http.StatusConflict" 10 | "Symfony HTTP Status Constant": "Response::HTTP_CONFLICT" 11 | "Python2 HTTP Status Constant": "httplib.CONFLICT" 12 | "Python3+ HTTP Status Constant": "http.client.CONFLICT" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.CONFLICT" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 请求与服务器端目标资源的当前状态相冲突。 20 | 21 | The request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request. 22 | 23 | The server SHOULD generate a payload that includes enough information for a user to recognize the source of the conflict. 24 | 25 | Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the representation being PUT included changes to a resource that conflict with those made by an earlier (third-party) request, the origin server might use a 409 response to indicate that it can't complete the request. In this case, the response representation would likely contain information useful for merging the differences based on the revision history. 26 | 27 | --- 28 | 29 | * Source: [RFC7231 Section 6.5.8][1] 30 | 31 | [1]: 32 | -------------------------------------------------------------------------------- /pages/410.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 410 4 | title: Gone 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.Gone" 7 | "Rust HTTP Status Constant": "http::StatusCode::GONE" 8 | "Rails HTTP Status Symbol": ":gone" 9 | "Go HTTP Status Constant": "http.StatusGone" 10 | "Symfony HTTP Status Constant": "Response::HTTP_GONE" 11 | "Python2 HTTP Status Constant": "httplib.GONE" 12 | "Python3+ HTTP Status Constant": "http.client.GONE" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.GONE" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 请求的目标资源在原服务器上不存在了,并且是永久性的丢失。如果不清楚是否为永久或临时的丢失,应该使用404 20 | 21 | The target resource is no longer available at the origin server and that this condition is likely to be permanent. 22 | 23 | If the origin server does not know, or has no facility to determine, whether or not the condition is permanent, the status code [404 Not Found](/404) ought to be used instead. 24 | 25 | The 410 response is primarily intended to assist the task of web maintenance by notifying the recipient that the resource is intentionally unavailable and that the server owners desire that remote links to that resource be removed. Such an event is common for limited-time, promotional services and for resources belonging to individuals no longer associated with the origin server's site. It is not necessary to mark all permanently unavailable resources as "gone" or to keep the mark for any length of time -- that is left to the discretion of the server owner. 26 | 27 | A 410 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls[1](#ref-1). 28 | 29 | --- 30 | 31 | * 1 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][2] 32 | * Source: [RFC7231 Section 6.5.9][1] 33 | 34 | [1]: 35 | [2]: 36 | -------------------------------------------------------------------------------- /pages/411.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 411 4 | title: Length Required 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.LengthRequired" 7 | "Rust HTTP Status Constant": "http::StatusCode::LENGTH_REQUIRED" 8 | "Rails HTTP Status Symbol": ":length_required" 9 | "Go HTTP Status Constant": "http.StatusLengthRequired" 10 | "Symfony HTTP Status Constant": "Response::HTTP_LENGTH_REQUIRED" 11 | "Python2 HTTP Status Constant": "httplib.LENGTH_REQUIRED" 12 | "Python3+ HTTP Status Constant": "http.client.LENGTH_REQUIRED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.LENGTH_REQUIRED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 由于缺少确定的 `Content-Length` 首部字段,服务器拒绝客户端的请求。 20 | 21 | The server refuses to accept the request without a defined Content-Length[1](#ref-1). 22 | 23 | The client MAY repeat the request if it adds a valid Content-Length header field containing the length of the message body in the request message. 24 | 25 | --- 26 | 27 | * 1 Content-Length [RFC7230 Section 3.3.2][2] 28 | * Source: [RFC7231 Section 6.5.10][1] 29 | 30 | [1]: 31 | [2]: 32 | -------------------------------------------------------------------------------- /pages/412.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 412 4 | title: Precondition Failed 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.PreconditionFailed" 7 | "Rust HTTP Status Constant": "http::StatusCode::PRECONDITION_FAILED" 8 | "Rails HTTP Status Symbol": ":precondition_failed" 9 | "Go HTTP Status Constant": "http.StatusPreconditionFailed" 10 | "Symfony HTTP Status Constant": "Response::HTTP_PRECONDITION_FAILED" 11 | "Python2 HTTP Status Constant": "httplib.PRECONDITION_FAILED" 12 | "Python3+ HTTP Status Constant": "http.client.PRECONDITION_FAILED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.PRECONDITION_FAILED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | One or more conditions given in the request header fields evaluated to false when tested on the server. 20 | 21 | This response code allows the client to place preconditions on the current resource state (its current representations and metadata) and, thus, prevent the request method from being applied if the target resource is in an unexpected state. 22 | 23 | --- 24 | 25 | * Source: [RFC7232 Section 4.2][1] 26 | 27 | [1]: 28 | -------------------------------------------------------------------------------- /pages/413.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 413 4 | title: Payload Too Large 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.RequestEntityTooLarge" 7 | "Rust HTTP Status Constant": "http::StatusCode::PAYLOAD_TOO_LARGE" 8 | "Rails HTTP Status Symbol": ":request_entity_too_large" 9 | "Go HTTP Status Constant": "http.StatusRequestEntityTooLarge" 10 | "Symfony HTTP Status Constant": "Response::HTTP_REQUEST_ENTITY_TOO_LARGE" 11 | "Python2 HTTP Status Constant": "httplib.REQUEST_ENTITY_TOO_LARGE" 12 | "Python3+ HTTP Status Constant": "http.client.REQUEST_ENTITY_TOO_LARGE" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.REQUEST_ENTITY_TOO_LARGE" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | The server is refusing to process a request because the request payload is larger than the server is willing or able to process. 20 | 21 | The server MAY close the connection to prevent the client from continuing the request. 22 | 23 | If the condition is temporary, the server SHOULD generate a Retry-After header field to indicate that it is temporary and after what time the client MAY try again. 24 | 25 | --- 26 | 27 | * Source: [RFC7231 Section 6.5.11][1] 28 | 29 | [1]: 30 | -------------------------------------------------------------------------------- /pages/414.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 414 4 | title: Request-URI Too Long 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.RequestUriTooLong" 7 | "Rust HTTP Status Constant": "http::StatusCode::URI_TOO_LONG" 8 | "Rails HTTP Status Symbol": ":request_uri_too_long" 9 | "Go HTTP Status Constant": "http.StatusRequestURITooLong" 10 | "Symfony HTTP Status Constant": "Response::HTTP_REQUEST_URI_TOO_LONG" 11 | "Python2 HTTP Status Constant": "httplib.REQUEST_URI_TOO_LONG" 12 | "Python3+ HTTP Status Constant": "http.client.REQUEST_URI_TOO_LONG" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.REQUEST_URI_TOO_LONG" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | The server is refusing to service the request because the request-target[1](#ref-1) is longer than the server is willing to interpret. 20 | 21 | This rare condition is only likely to occur when a client has improperly converted a POST request to a GET request with long query information, when the client has descended into a "black hole" of redirection (e.g., a redirected URI prefix that points to a suffix of itself) or when the server is under attack by a client attempting to exploit potential security holes. 22 | 23 | A 414 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls [2](#ref-2). 24 | 25 | --- 26 | 27 | * 1 Content Negotiation [RFC7230 Section 5.3][2] 28 | * 2 Calculating Heuristic Freshness RFC7234 Section 4.2.2][3] 29 | * Source: [RFC7231 Section 6.5.12][1] 30 | 31 | [1]: 32 | [2]: 33 | [3]: 34 | -------------------------------------------------------------------------------- /pages/415.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 415 4 | title: Unsupported Media Type 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.UnsupportedMediaType" 7 | "Rust HTTP Status Constant": "http::StatusCode::UNSUPPORTED_MEDIA_TYPE" 8 | "Rails HTTP Status Symbol": ":unsupported_media_type" 9 | "Go HTTP Status Constant": "http.StatusUnsupportedMediaType" 10 | "Symfony HTTP Status Constant": "Response::HTTP_UNSUPPORTED_MEDIA_TYPE" 11 | "Python2 HTTP Status Constant": "httplib.UNSUPPORTED_MEDIA_TYPE" 12 | "Python3+ HTTP Status Constant": "http.client.UNSUPPORTED_MEDIA_TYPE" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.UNSUPPORTED_MEDIA_TYPE" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | The origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource. 20 | 21 | The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly. 22 | 23 | --- 24 | 25 | * Source: [RFC7231 Section 6.5.13][1] 26 | 27 | [1]: 28 | -------------------------------------------------------------------------------- /pages/416.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 416 4 | title: Requested Range Not Satisfiable 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.RequestedRangeNotSatisfiable" 7 | "Rust HTTP Status Constant": "http::StatusCode::RANGE_NOT_SATISFIABLE" 8 | "Rails HTTP Status Symbol": ":requested_range_not_satisfiable" 9 | "Go HTTP Status Constant": "http.StatusRequestedRangeNotSatisfiable" 10 | "Symfony HTTP Status Constant": "Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE" 11 | "Python2 HTTP Status Constant": "httplib.REQUESTED_RANGE_NOT_SATISFIABLE" 12 | "Python3+ HTTP Status Constant": "http.client.REQUESTED_RANGE_NOT_SATISFIABLE" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | None of the ranges in the request's Range header field[1](#ref-1) overlap the current extent of the selected resource or that the set of ranges requested has been rejected due to invalid ranges or an excessive request of small or overlapping ranges. 20 | 21 | For byte ranges, failing to overlap the current extent means that the first-byte-pos of all of the byte-range-spec values were greater than the current length of the selected representation. When this status code is generated in response to a byte-range request, the sender SHOULD generate a Content-Range header field specifying the current length of the selected representation[2](#ref-2). 22 | 23 | For example: 24 | 25 | ``` 26 | HTTP/1.1 416 Range Not Satisfiable 27 | Date: Fri, 20 Jan 2012 15:41:54 GMT 28 | Content-Range: bytes */47022 29 | ``` 30 | 31 | Note: Because servers are free to ignore Range, many implementations will simply respond with the entire selected representation in a [200 OK](/200) response. That is partly because most clients are prepared to receive a [200 OK](/200) to complete the task (albeit less efficiently) and partly because clients might not stop making an invalid partial request until they have received a complete representation. Thus, clients cannot depend on receiving a 416 Range Not Satisfiable response even when it is most appropriate. 32 | 33 | --- 34 | 35 | * 1 Range [RFC7233 Section 3.1][2] 36 | * 2 Content-Range [RFC7233 Section 4.2][3] 37 | * Source: [RFC7233 Section 4.4][1] 38 | 39 | [1]: 40 | [2]: 41 | [3]: 42 | -------------------------------------------------------------------------------- /pages/417.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 417 4 | title: Expectation Failed 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.ExpectationFailed" 7 | "Rust HTTP Status Constant": "http::StatusCode::EXPECTATION_FAILED" 8 | "Rails HTTP Status Symbol": ":expectation_failed" 9 | "Go HTTP Status Constant": "http.StatusExpectationFailed" 10 | "Symfony HTTP Status Constant": "Response::HTTP_EXPECTATION_FAILED" 11 | "Python2 HTTP Status Constant": "httplib.EXPECTATION_FAILED" 12 | "Python3+ HTTP Status Constant": "http.client.EXPECTATION_FAILED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.EXPECTATION_FAILED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | The expectation given in the request's Expect header field[1](#ref-1) could not be met by at least one of the inbound servers. 20 | 21 | --- 22 | 23 | * 1 Expect [RFC7231 Section 5.1.1][2] 24 | * Source: [RFC7231 Section 6.5.14][1] 25 | 26 | [1]: 27 | [2]: 28 | -------------------------------------------------------------------------------- /pages/418.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 418 4 | title: I'm a teapot 5 | references: 6 | ".NET HTTP Status Enum": "StatusCodes.Status418ImATeapot" 7 | "Rust HTTP Status Constant": "http::StatusCode::IM_A_TEAPOT" 8 | "Go HTTP Status Constant": "http.StatusTeapot" 9 | "Symfony HTTP Status Constant": "Response::HTTP_I_AM_A_TEAPOT" 10 | --- 11 | import CodeTitle from '../components/CodeTitle' 12 | 13 | 14 | 15 | Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY be short and stout. 16 | 17 | --- 18 | 19 | * Source: [RFC2324 Section 2.3.2][1] 20 | 21 | [1]: 22 | -------------------------------------------------------------------------------- /pages/421.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 421 4 | title: Misdirected Request 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.MisdirectedRequest" 7 | "Rust HTTP Status Constant": "http::StatusCode::MISDIRECTED_REQUEST" 8 | "Rails HTTP Status Symbol": ":misdirected_request" 9 | --- 10 | import CodeTitle from '../components/CodeTitle' 11 | 12 | 13 | 14 | The request was directed at a server that is not able to produce a response. This can be sent by a server that is not configured to produce responses for the combination of scheme and authority that are included in the request URI. 15 | 16 | Clients receiving a 421 Misdirected Request response from a server MAY retry the request -- whether the request method is idempotent or not -- over a different connection. This is possible if a connection is reused[1](#ref-1)or if an alternative service is selected [ALT-SVC][3]. 17 | 18 | This status code MUST NOT be generated by proxies. 19 | 20 | A 421 response is cacheable by default, i.e., unless otherwise indicated by the method definition or explicit cache controls[2](#ref-2). 21 | 22 | --- 23 | 24 | * 1 Connection Reuse [RFC7540 Section 9.1.1][2] 25 | * 2 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][4] 26 | * Source: [RFC7540 Section 9.1.2][1] 27 | 28 | [1]: 29 | [2]: 30 | [3]: 31 | [4]: 32 | -------------------------------------------------------------------------------- /pages/422.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 422 4 | title: Unprocessable Entity 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.UnprocessableEntity" 7 | "Rust HTTP Status Constant": "http::StatusCode::UNPROCESSABLE_ENTITY" 8 | "Rails HTTP Status Symbol": ":unprocessable_entity" 9 | "Symfony HTTP Status Constant": "Response::HTTP_UNPROCESSABLE_ENTITY" 10 | --- 11 | import CodeTitle from '../components/CodeTitle' 12 | 13 | 14 | 15 | The server understands the content type of the request entity (hence a [415 Unsupported Media Type](/415) status code is inappropriate), and the syntax of the request entity is correct (thus a [400 Bad Request](/400) status code is inappropriate) but was unable to process the contained instructions. 16 | 17 | For example, this error condition may occur if an XML request body contains well-formed (i.e., syntactically correct), but semantically erroneous, XML instructions. 18 | 19 | --- 20 | 21 | * Source: [RFC4918 Section 11.2][1] 22 | 23 | [1]: 24 | -------------------------------------------------------------------------------- /pages/423.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 423 4 | title: Locked 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.Locked" 7 | "Rust HTTP Status Constant": "http::StatusCode::LOCKED" 8 | "Rails HTTP Status Symbol": ":locked" 9 | "Symfony HTTP Status Constant": "Response::HTTP_LOCKED" 10 | --- 11 | import CodeTitle from '../components/CodeTitle' 12 | 13 | 14 | 15 | The source or destination resource of a method is locked. 16 | 17 | This response SHOULD contain an appropriate precondition or postcondition code, such as 'lock-token-submitted' or 'no-conflicting-lock'. 18 | 19 | --- 20 | 21 | * Source: [RFC4918 Section 11.3][1] 22 | 23 | [1]: 24 | -------------------------------------------------------------------------------- /pages/424.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 424 4 | title: Failed Dependency 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.FailedDependency" 7 | "Rust HTTP Status Constant": "http::StatusCode::FAILED_DEPENDENCY" 8 | "Rails HTTP Status Symbol": "failed_dependency" 9 | "Symfony HTTP Status Constant": "Response::HTTP_FAILED_DEPENDENCY" 10 | "Python HTTP Status Constant": "httplib.FAILED_DEPENDENCY" 11 | --- 12 | import CodeTitle from '../components/CodeTitle' 13 | 14 | 15 | 16 | The method could not be performed on the resource because the requested action depended on another action and that action failed. 17 | 18 | For example, if a command in a PROPPATCH method fails, then, at minimum, the rest of the commands will also fail with 424 Failed Dependency. 19 | 20 | --- 21 | 22 | * Source: [RFC4918 Section 11.4][1] 23 | 24 | [1]: 25 | -------------------------------------------------------------------------------- /pages/426.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 426 4 | title: Upgrade Required 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.UpgradeRequired" 7 | "Rust HTTP Status Constant": "http::StatusCode::UPGRADE_REQUIRED" 8 | "Rails HTTP Status Symbol": ":upgrade_required" 9 | "Symfony HTTP Status Constant": "Response::HTTP_UPGRADE_REQUIRED" 10 | --- 11 | import CodeTitle from '../components/CodeTitle' 12 | 13 | 14 | 15 | The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. 16 | 17 | The server MUST send an Upgrade header field in a 426 response to indicate the required protocol(s)[1](#ref-1) 18 | 19 | Example: 20 | 21 | ``` plain 22 | HTTP/1.1 426 Upgrade Required 23 | Upgrade: HTTP/3.0 24 | Connection: Upgrade 25 | Content-Length: 53 26 | Content-Type: text/plain 27 | 28 | This service requires use of the HTTP/3.0 protocol. 29 | ``` 30 | 31 | --- 32 | 33 | * 1 Upgrade [RFC7230 Section 6.7][2] 34 | * Source: [RFC7231 Section 6.5.15][1] 35 | 36 | [1]: 37 | [2]: 38 | -------------------------------------------------------------------------------- /pages/428.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 428 4 | title: Precondition Required 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.PreconditionRequired" 7 | "Rust HTTP Status Constant": "http::StatusCode::PRECONDITION_REQUIRED" 8 | "Symfony HTTP Status Constant": "Response::HTTP_PRECONDITION_REQUIRED" 9 | --- 10 | import CodeTitle from '../components/CodeTitle' 11 | 12 | 13 | 14 | The origin server requires the request to be conditional. 15 | 16 | Its typical use is to avoid the "lost update" problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict. By requiring requests to be conditional, the server can assure that clients are working with the correct copies. 17 | 18 | Responses using this status code SHOULD explain how to resubmit the request successfully. For example: 19 | 20 | ```html 21 | HTTP/1.1 428 Precondition Required 22 | Content-Type: text/html 23 | 24 | 25 | 26 | Precondition Required 27 | 28 | 29 |

Precondition Required

30 |

This request is required to be conditional; try using "If-Match".

31 | 32 | 33 | ``` 34 | 35 | Responses with the 428 status code MUST NOT be stored by a cache. 36 | 37 | --- 38 | 39 | * Source: [RFC6585 Section 3][1] 40 | 41 | [1]: 42 | -------------------------------------------------------------------------------- /pages/429.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 429 4 | title: Too Many Requests 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.TooManyRequests" 7 | "Rust HTTP Status Constant": "http::StatusCode::TOO_MANY_REQUESTS" 8 | "Symfony HTTP Status Constant": "Response::HTTP_TOO_MANY_REQUESTS" 9 | --- 10 | import CodeTitle from '../components/CodeTitle' 11 | 12 | 13 | 14 | The user has sent too many requests in a given amount of time ("rate limiting"). 15 | 16 | The response representations SHOULD include details explaining the condition, and MAY include a Retry-After header indicating how long to wait before making a new request. 17 | 18 | For example: 19 | 20 | ```html 21 | HTTP/1.1 429 Too Many Requests 22 | Content-Type: text/html 23 | Retry-After: 3600 24 | 25 | 26 | 27 | Too Many Requests 28 | 29 | 30 |

Too Many Requests

31 |

I only allow 50 requests per hour to this Web site per 32 | logged in user. Try again soon.

33 | 34 | 35 | ``` 36 | 37 | Note that this specification does not define how the origin server identifies the user, nor how it counts requests. For example, an origin server that is limiting request rates can do so based upon counts of requests on a per-resource basis, across the entire server, or even among a set of servers. Likewise, it might identify the user by its authentication credentials, or a stateful cookie. 38 | 39 | Responses with the 429 status code MUST NOT be stored by a cache. 40 | 41 | --- 42 | 43 | * Source: [RFC6585 Section 4][1] 44 | 45 | [1]: 46 | -------------------------------------------------------------------------------- /pages/431.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 431 4 | title: Request Header Fields Too Large 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.RequestHeaderFieldsTooLarge" 7 | "Rust HTTP Status Constant": "http::StatusCode::REQUEST_HEADER_FIELDS_TOO_LARGE" 8 | "Symfony HTTP Status Constant": "Response::HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE" 9 | --- 10 | import CodeTitle from '../components/CodeTitle' 11 | 12 | 13 | 14 | The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields. 15 | 16 | It can be used both when the set of request header fields in total is too large, and when a single header field is at fault. In the latter case, the response representation SHOULD specify which header field was too large. 17 | 18 | For example: 19 | 20 | ```html 21 | HTTP/1.1 431 Request Header Fields Too Large 22 | Content-Type: text/html 23 | 24 | 25 | 26 | Request Header Fields Too Large 27 | 28 | 29 |

Request Header Fields Too Large

30 |

The "Example" header was too large.

31 | 32 | 33 | ``` 34 | 35 | Responses with the 431 status code MUST NOT be stored by a cache. 36 | 37 | --- 38 | 39 | * Source: [RFC6585 Section 5][1] 40 | 41 | [1]: 42 | -------------------------------------------------------------------------------- /pages/444.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | # This is not a status code available in the standard. 3 | set: 4 4 | code: 444 5 | title: Connection Closed Without Response 6 | --- 7 | 8 | A non-standard status code used to instruct [nginx][2] to close the connection without sending a response to the client, most commonly used to deny malicious or malformed requests. 9 | 10 | This status code is not seen by the client, it only appears in nginx log files. 11 | 12 | --- 13 | 14 | * Source: [nginx documentation][1] 15 | 16 | [1]: 17 | [2]: 18 | -------------------------------------------------------------------------------- /pages/451.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 451 4 | title: Unavailable For Legal Reasons 5 | proposal: true 6 | references: 7 | ".NET HTTP Status Enum": "HttpStatusCode.UnavailableForLegalReasons" 8 | "Rust HTTP Status Constant": "http::StatusCode::UNAVAILABLE_FOR_LEGAL_REASONS" 9 | "Symfony HTTP Status Constant": "Response::HTTP_UNAVAILABLE_FOR_LEGAL_REASONS" 10 | --- 11 | import CodeTitle from '../components/CodeTitle' 12 | 13 | 14 | 15 | The server is denying access to the resource as a consequence of a legal demand. 16 | 17 | The server in question might not be an origin server. This type of legal demand typically most directly affects the operations of ISPs and search engines. 18 | 19 | Responses using this status code SHOULD include an explanation, in the response body, of the details of the legal demand: the party making it, the applicable legislation or regulation, and what classes of person and resource it applies to. For example: 20 | 21 | ```html 22 | HTTP/1.1 451 Unavailable For Legal Reasons 23 | Link: ; rel="blocked-by" 24 | Content-Type: text/html 25 | 26 | 27 | 28 | Unavailable For Legal Reasons 29 | 30 | 31 |

Unavailable For Legal Reasons

32 |

This request may not be serviced in the Roman Province 33 | of Judea due to the Lex Julia Majestatis, which disallows 34 | access to resources hosted on servers deemed to be 35 | operated by the People's Front of Judea.

36 | 37 | 38 | ``` 39 | 40 | The use of the 451 status code implies neither the existence nor non- existence of the resource named in the request. That is to say, it is possible that if the legal demands were removed, a request for the resource still might not succeed. 41 | 42 | Note that in many cases clients can still access the denied resource by using technical countermeasures such as a VPN or the Tor network. 43 | 44 | A 451 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls; see [RFC7234][2]. 45 | 46 | --- 47 | 48 | * Source: [RFC 7725][1] 49 | 50 | [1]: 51 | [2]: 52 | -------------------------------------------------------------------------------- /pages/499.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | # This is not a status code available in the standard, but it exists 3 | # with significant prominence in the wild 4 | set: 4 5 | code: 499 6 | title: Client Closed Request 7 | --- 8 | 9 | A non-standard status code introduced by [nginx][2] for the case when a client closes the connection while nginx is processing the request. 10 | 11 | --- 12 | 13 | * Source: [nginx.org][1] 14 | 15 | [1]: 16 | [2]: 17 | -------------------------------------------------------------------------------- /pages/500.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 500 4 | title: Internal Server Error 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.InternalServerError" 7 | "Rust HTTP Status Constant": "http::StatusCode::INTERNAL_SERVER_ERROR" 8 | "Rails HTTP Status Symbol": ":internal_server_error" 9 | "Go HTTP Status Constant": "http.StatusInternalServerError" 10 | "Symfony HTTP Status Constant": "Response::HTTP_INTERNAL_SERVER_ERROR" 11 | "Python2 HTTP Status Constant": "httplib.INTERNAL_SERVER_ERROR" 12 | "Python3+ HTTP Status Constant": "http.client.INTERNAL_SERVER_ERROR" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.INTERNAL_SERVER_ERROR" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | The server encountered an unexpected condition that prevented it from fulfilling the request. 20 | 21 | --- 22 | 23 | * Source: [RFC7231 Section 6.6.1][1] 24 | 25 | [1]: 26 | -------------------------------------------------------------------------------- /pages/501.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 501 4 | title: Not Implemented 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.NotImplemented" 7 | "Rust HTTP Status Constant": "http::StatusCode::NOT_IMPLEMENTED" 8 | "Rails HTTP Status Symbol": ":not_implemented" 9 | "Go HTTP Status Constant": "http.StatusNotImplemented" 10 | "Symfony HTTP Status Constant": "Response::HTTP_NOT_IMPLEMENTED" 11 | "Python2 HTTP Status Constant": "httplib.NOT_IMPLEMENTED" 12 | "Python3+ HTTP Status Constant": "http.client.NOT_IMPLEMENTED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.NOT_IMPLEMENTED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | The server does not support the functionality required to fulfill the request. 20 | 21 | This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource. 22 | 23 | A 501 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls[1](#ref-1). 24 | 25 | --- 26 | 27 | * 1 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][2] 28 | * Source: [RFC7231 Section 6.6.2][1] 29 | 30 | [1]: 31 | [2]: 32 | -------------------------------------------------------------------------------- /pages/502.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 502 4 | title: Bad Gateway 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.BadGateway" 7 | "Rust HTTP Status Constant": "http::StatusCode::BAD_GATEWAY" 8 | "Rails HTTP Status Symbol": ":bad_gateway" 9 | "Go HTTP Status Constant": "http.StatusBadGateway" 10 | "Symfony HTTP Status Constant": "Response::HTTP_BAD_GATEWAY" 11 | "Python2 HTTP Status Constant": "httplib.BAD_GATEWAY" 12 | "Python3+ HTTP Status Constant": "http.client.BAD_GATEWAY" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.BAD_GATEWAY" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request. 20 | 21 | --- 22 | 23 | * Source: [RFC7231 Section 6.6.3][1] 24 | 25 | [1]: 26 | -------------------------------------------------------------------------------- /pages/503.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 503 4 | title: Service Unavailable 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.ServiceUnavailable" 7 | "Rust HTTP Status Constant": "http::StatusCode::SERVICE_UNAVAILABLE" 8 | "Rails HTTP Status Symbol": ":service_unavailable" 9 | "Go HTTP Status Constant": "http.StatusServiceUnavailable" 10 | "Symfony HTTP Status Constant": "Response::HTTP_SERVICE_UNAVAILABLE" 11 | "Python2 HTTP Status Constant": "httplib.SERVICE_UNAVAILABLE" 12 | "Python3+ HTTP Status Constant": "http.client.SERVICE_UNAVAILABLE" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.SERVICE_UNAVAILABLE" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay. 20 | 21 | The server MAY send a Retry-After header field[1](#ref-1) to suggest an appropriate amount of time for the client to wait before retrying the request. 22 | 23 | Note: The existence of the 503 status code does not imply that a server has to use it when becoming overloaded. Some servers might simply refuse the connection. 24 | 25 | --- 26 | 27 | * 1 Retry-After [RFC7231 Section 7.1.3][2] 28 | * Source: [RFC7231 Section 6.6.4][1] 29 | 30 | [1]: 31 | [2]: 32 | -------------------------------------------------------------------------------- /pages/504.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 504 4 | title: Gateway Timeout 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.GatewayTimeout" 7 | "Rust HTTP Status Constant": "http::StatusCode::GATEWAY_TIMEOUT" 8 | "Rails HTTP Status Symbol": ":gateway_timeout" 9 | "Go HTTP Status Constant": "http.StatusGatewayTimeout" 10 | "Symfony HTTP Status Constant": "Response::HTTP_GATEWAY_TIMEOUT" 11 | "Python2 HTTP Status Constant": "httplib.GATEWAY_TIMEOUT" 12 | "Python3+ HTTP Status Constant": "http.client.GATEWAY_TIMEOUT" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.GATEWAY_TIMEOUT" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request. 20 | 21 | --- 22 | 23 | * Source: [RFC7231 Section 6.6.5][1] 24 | 25 | [1]: 26 | -------------------------------------------------------------------------------- /pages/505.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 505 4 | title: HTTP Version Not Supported 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.HttpVersionNotSupported" 7 | "Rust HTTP Status Constant": "http::StatusCode::HTTP_VERSION_NOT_SUPPORTED" 8 | "Rails HTTP Status Symbol": ":http_version_not_supported" 9 | "Go HTTP Status Constant": "http.StatusHTTPVersionNotSupported" 10 | "Symfony HTTP Status Constant": "Response::HTTP_VERSION_NOT_SUPPORTED" 11 | "Python2 HTTP Status Constant": "httplib.VERSION_NOT_SUPPORTED" 12 | "Python3+ HTTP Status Constant": "http.client.VERSION_NOT_SUPPORTED" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.VERSION_NOT_SUPPORTED" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | The server does not support, or refuses to support, the major version of HTTP that was used in the request message. 20 | 21 | The server is indicating that it is unable or unwilling to complete the request using the same major version as the client, as described in [Section 2.6 of RFC7230][2], other than with this error message. The server SHOULD generate a representation for the 505 response that describes why that version is not supported and what other protocols are supported by that server. 22 | 23 | --- 24 | 25 | * Source: [RFC7231 Section 6.6.6][1] 26 | 27 | [1]: 28 | [2]: 29 | -------------------------------------------------------------------------------- /pages/506.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 506 4 | title: Variant Also Negotiates 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.VariantAlsoNegotiates" 7 | "Rust HTTP Status Constant": "http::StatusCode::VARIANT_ALSO_NEGOTIATES" 8 | "Symfony HTTP Status Constant": "Response::HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL" 9 | --- 10 | import CodeTitle from '../components/CodeTitle' 11 | 12 | 13 | 14 | The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process. 15 | 16 | --- 17 | 18 | * Source: [RFC2295 Section 8.1][1] 19 | 20 | [1]: 21 | -------------------------------------------------------------------------------- /pages/507.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 507 4 | title: Insufficient Storage 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.InsufficientStorage" 7 | "Rust HTTP Status Constant": "http::StatusCode::INSUFFICIENT_STORAGE" 8 | "Rails HTTP Status Symbol": ":insufficient_storage" 9 | "Symfony HTTP Status Constant": "Response::HTTP_INSUFFICIENT_STORAGE" 10 | --- 11 | import CodeTitle from '../components/CodeTitle' 12 | 13 | 14 | 15 | The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request. 16 | 17 | This condition is considered to be temporary. If the request that received this status code was the result of a user action, the request MUST NOT be repeated until it is requested by a separate user action. 18 | 19 | --- 20 | 21 | * Source: [RFC4918 Section 11.5][1] 22 | 23 | [1]: 24 | -------------------------------------------------------------------------------- /pages/508.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 508 4 | title: Loop Detected 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.LoopDetected" 7 | "Rust HTTP Status Constant": "http::StatusCode::LOOP_DETECTED" 8 | "Symfony HTTP Status Constant": "Response::HTTP_LOOP_DETECTED" 9 | --- 10 | import CodeTitle from '../components/CodeTitle' 11 | 12 | 13 | 14 | The server terminated an operation because it encountered an infinite loop while processing a request with "Depth: infinity". This status indicates that the entire operation failed. 15 | 16 | --- 17 | 18 | * Source: [RFC5842 Section 7.2][1] 19 | 20 | [1]: 21 | -------------------------------------------------------------------------------- /pages/510.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 510 4 | title: Not Extended 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.NotExtended" 7 | "Rust HTTP Status Constant": "http::StatusCode::NOT_EXTENDED" 8 | "Rails HTTP Status Symbol": ":not_extended" 9 | "Symfony HTTP Status Constant": "Response::HTTP_NOT_EXTENDED" 10 | --- 11 | import CodeTitle from '../components/CodeTitle' 12 | 13 | 14 | 15 | The policy for accessing the resource has not been met in the request. The server should send back all the information necessary for the client to issue an extended request. 16 | 17 | It is outside the scope of this specification to specify how the extensions inform the client. 18 | 19 | If the 510 response contains information about extensions that were not present in the initial request then the client MAY repeat the request if it has reason to believe it can fulfill the extension policy by modifying the request according to the information provided in the 510 response. Otherwise the client MAY present any entity included in the 510 response to the user, since that entity may include relevant diagnostic information. 20 | 21 | --- 22 | 23 | * Source: [RFC2774 Section 7][1] 24 | 25 | [1]: 26 | -------------------------------------------------------------------------------- /pages/511.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 5 3 | code: 511 4 | title: Network Authentication Required 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.NetworkAuthenticationRequired" 7 | "Rust HTTP Status Constant": "http::StatusCode::NETWORK_AUTHENTICATION_REQUIRED" 8 | "Symfony HTTP Status Constant": "Response::HTTP_NETWORK_AUTHENTICATION_REQUIRED" 9 | --- 10 | import CodeTitle from '../components/CodeTitle' 11 | 12 | 13 | 14 | The client needs to authenticate to gain network access. 15 | 16 | The response representation SHOULD contain a link to a resource that allows the user to submit credentials (e.g., with an HTML form). 17 | 18 | Note that the 511 response SHOULD NOT contain a challenge or the login interface itself, because browsers would show the login interface as being associated with the originally requested URL, which may cause confusion. 19 | 20 | The 511 status SHOULD NOT be generated by origin servers; it is intended for use by intercepting proxies that are interposed as a means of controlling access to the network. 21 | 22 | Responses with the 511 status code MUST NOT be stored by a cache. 23 | 24 | The 511 status code is designed to mitigate problems caused by "captive portals" to software (especially non-browser agents) that is expecting a response from the server that a request was made to, not the intervening network infrastructure. It is not intended to encourage deployment of captive portals -- only to limit the damage caused by them. 25 | 26 | A network operator wishing to require some authentication, acceptance of terms, or other user interaction before granting access usually does so by identifying clients who have not done so ("unknown clients") using their Media Access Control (MAC) addresses. 27 | 28 | Unknown clients then have all traffic blocked, except for that on TCP port 80, which is sent to an HTTP server (the "login server") dedicated to "logging in" unknown clients, and of course traffic to the login server itself. 29 | 30 | For example, a user agent might connect to a network and make the following HTTP request on TCP port 80: 31 | 32 | ```plain 33 | GET /index.htm HTTP/1.1 34 | Host: www.example.com 35 | ``` 36 | 37 | Upon receiving such a request, the login server would generate a 511 response: 38 | 39 | ```html 40 | HTTP/1.1 511 Network Authentication Required 41 | Content-Type: text/html 42 | 43 | 44 | 45 | Network Authentication Required 46 | 47 | 48 | 49 |

You need to 50 | authenticate with the local network in order to gain 51 | access.

52 | 53 | 54 | ``` 55 | 56 | Here, the 511 status code assures that non-browser clients will not interpret the response as being from the origin server, and the META HTML element redirects the user agent to the login server. 57 | 58 | --- 59 | 60 | * Source: [RFC6585 Section 6][1] 61 | 62 | [1]: 63 | -------------------------------------------------------------------------------- /pages/599.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | # This is not a status code available in the standard, but it exists 3 | # with significant prominence in the wild 4 | set: 5 5 | code: 599 6 | title: Network Connect Timeout Error 7 | --- 8 | import CodeTitle from '../components/CodeTitle' 9 | 10 | 11 | 12 | This status code is not specified in any RFCs, but is used by some HTTP proxies to signal a network connect timeout behind the proxy to a client in front of the proxy. 13 | 14 | --- 15 | 16 | * Source: [unknown?][1] 17 | 18 | [1]: 19 | -------------------------------------------------------------------------------- /pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react' 2 | import { Helmet } from 'react-helmet' 3 | import AppProps from 'next/app' 4 | import Router from 'next/router' 5 | import { MDXProvider } from '@mdx-js/react' 6 | 7 | import { initGA, logPageView } from '../lib/ga' 8 | import '../styles/index.css' 9 | 10 | function MyApp({ Component, pageProps }: any) { 11 | useEffect(() => { 12 | if (process.env.gaId) { 13 | initGA() 14 | logPageView() 15 | Router.events.on('routeChangeComplete', logPageView) 16 | } 17 | }, []) 18 | 19 | const meta = [ 20 | { 21 | name: 'viewport', 22 | content: 'width=device-width, initial-scale=1', 23 | } 24 | ] 25 | 26 | const components = { 27 | wrapper: (props: any) =>
, 28 | // h1: (props: any) =>

, 29 | // h2: (props: any) =>

, 30 | // h3: (props: any) =>

, 31 | // p: (props: any) =>

, 32 | // inlineCode: (props: any) => , 33 | } 34 | 35 | if (process.env.baiduToken) { 36 | meta.push({ 37 | name: 'baidu-site-verification', 38 | content: process.env.baiduToken 39 | }) 40 | } 41 | 42 | return ( 43 | 44 | 49 | 50 | 51 | ) 52 | } 53 | 54 | export default MyApp 55 | -------------------------------------------------------------------------------- /pages/_document.tsx: -------------------------------------------------------------------------------- 1 | import Document, { Html, Head, Main, NextScript } from 'next/document' 2 | import { Helmet, HelmetData } from 'react-helmet' 3 | 4 | export default class extends Document<{ 5 | helmet: HelmetData 6 | }> { 7 | static async getInitialProps(args: any) { 8 | const documentProps = await super.getInitialProps(args) 9 | // see https://github.com/nfl/react-helmet#server-usage for more information 10 | // 'head' was occupied by 'renderPage().head', we cannot use it 11 | return { ...documentProps, helmet: Helmet.renderStatic() } 12 | } 13 | 14 | // should render on 15 | get helmetHtmlAttrComponents() { 16 | return this.props.helmet.htmlAttributes.toComponent() 17 | } 18 | 19 | // should render on 20 | get helmetBodyAttrComponents() { 21 | return this.props.helmet.bodyAttributes.toComponent() 22 | } 23 | 24 | // should render on 25 | get helmetHeadComponents() { 26 | return Object.keys(this.props.helmet) 27 | .filter(el => el !== 'htmlAttributes' && el !== 'bodyAttributes') 28 | .map(el => (this.props.helmet as any)[el].toComponent()) 29 | } 30 | 31 | render() { 32 | return ( 33 | 34 | {this.helmetHeadComponents} 35 | 36 |

37 | 38 | 39 | 40 | ) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /pages/about.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Helmet } from 'react-helmet' 3 | import Link from 'next/link' 4 | 5 | export default function About() { 6 | return ( 7 |
8 | 12 |

13 | About Page 14 |

15 | 16 | Back to home 17 | 18 |
19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /pages/api/hello.ts: -------------------------------------------------------------------------------- 1 | import type { NextApiRequest, NextApiResponse } from 'next' 2 | 3 | type Data = { 4 | name: string 5 | } 6 | 7 | export default (req: NextApiRequest, res: NextApiResponse) => { 8 | res.status(200).json({ name: 'John Doe' }) 9 | } -------------------------------------------------------------------------------- /pages/demo/upload.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback, useState } from "react" 2 | 3 | const isProduction = process.env.NODE_ENV === 'production' 4 | 5 | export default function FileUpload() { 6 | const [src, setSrc] = useState('') 7 | 8 | const handleUpload = useCallback((e: any) => { 9 | const files = e.target.files 10 | const file: File = files[0] 11 | fetch(`${isProduction ? '' : 'http://localhost:8000'}/api/upload-jpeg?cors=true`, { 12 | method: 'POST', 13 | body: file, 14 | headers: { 15 | 'content-type': 'image/jpeg' 16 | } 17 | }).then(res => res.json()).then(o => { 18 | setSrc(o.src) 19 | }) 20 | }, []) 21 | 22 | return ( 23 |
24 | 25 |
    26 |
  • 图片被上传至后端,后端又上传至 OSS:
  • 27 |
  • 28 | 图片地址:{src} 29 |
  • 30 |
  • 31 | 前端代码:https://github.com/shfshanyue/httpstatus/blob/master/pages/demo/upload.tsx 32 |
  • 33 |
  • 34 | 后端代码:https://github.com/shfshanyue/httpstatus/tree/master/api 35 |
  • 36 |
37 | 38 |
39 | ) 40 | } -------------------------------------------------------------------------------- /pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { Helmet } from 'react-helmet' 2 | import * as _ from 'midash' 3 | import Link from 'next/link' 4 | import Image from 'next/image' 5 | 6 | import code from '../lib/code.json' 7 | import ApifoxImage from '../assets/apifox.webp' 8 | 9 | const data = _.groupBy(code, x => x.code.toString()[0]) 10 | const groups = Object.entries(data).map(([ key, list ]) => { 11 | const message = ['Informational', 'Success', 'Redirection', 'Client Error', 'Server Error'] 12 | return { 13 | code: key.padEnd(3, 'x'), 14 | name: message[Number(key) - 1], 15 | list: list.sort((x, y) => x.code - y.code) 16 | } 17 | }) 18 | 19 | function Home() { 20 | return ( 21 |
22 | 25 |

HTTP 状态码速查大全

26 |

27 | http.devtool.tech 是关于 HTTP 状态码的一个网站,可通过 http.devtool.tech/code 进行快速导航。 28 |

29 |

30 | 本工具由 Apifox 重度使用者开发,可通过 Apifox 探索发现各种开放 API,找到大部分状态码。该项目可通过 Github 仓库找到源码。 31 |

32 |
33 | {/* ★ Github Star */} 34 | {/* Apifox */} 35 |
36 |
37 |
38 |
39 |

API Hub

40 |
发现更多公开 API 项目
41 | 打开 Apifox 42 |
43 |
44 | API Hub 45 |
46 |
47 | { 48 | groups.map(group => ( 49 |
50 |

51 | {group.code} 52 | {' '} 53 | {group.name} 54 |

55 |
56 | { 57 | group.list.map(x => ( 58 | 59 | {x.code} 60 | {' '} 61 | {x.phrase} 62 | 63 | )) 64 | } 65 |
66 |
67 | )) 68 | } 69 |
70 |
71 | ) 72 | } 73 | 74 | export default Home 75 | -------------------------------------------------------------------------------- /pages/not-found.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | set: 4 3 | code: 404 4 | title: Not Found 5 | references: 6 | ".NET HTTP Status Enum": "HttpStatusCode.NotFound" 7 | "Rust HTTP Status Constant": "http::StatusCode::NOT_FOUND" 8 | "Rails HTTP Status Symbol": ":not_found" 9 | "Go HTTP Status Constant": "http.StatusNotFound" 10 | "Symfony HTTP Status Constant": "Response::HTTP_NOT_FOUND" 11 | "Python2 HTTP Status Constant": "httplib.NOT_FOUND" 12 | "Python3+ HTTP Status Constant": "http.client.NOT_FOUND" 13 | "Python3.5+ HTTP Status Constant": "http.HTTPStatus.NOT_FOUND" 14 | --- 15 | import CodeTitle from '../components/CodeTitle' 16 | 17 | 18 | 19 | 服务器无法找到所请求的资源。返回该响应的链接通常称为坏链(broken link)或死链(dead link) 20 | 21 | The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. 22 | 23 | A 404 status code does not indicate whether this lack of representation is temporary or permanent; the [410 Gone](/410) status code is preferred over 404 if the origin server knows, presumably through some configurable means, that the condition is likely to be permanent. 24 | 25 | A 404 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls[1](#ref-1). 26 | 27 | --- 28 | 29 | * 1 Calculating Heuristic Freshness [RFC7234 Section 4.2.2][2] 30 | * Source: [RFC7231 6.5.4][1] 31 | 32 | [1]: 33 | [2]: 34 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | // If you want to use other PostCSS plugins, see the following: 2 | // https://tailwindcss.com/docs/using-with-preprocessors 3 | module.exports = { 4 | plugins: { 5 | tailwindcss: {} 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shfshanyue/httpstatus/63932e70b2d0ae821186378154654c039646124f/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # * 2 | User-agent: * 3 | Allow: / 4 | 5 | # Host 6 | Host: https://next-app-shanyue.vercel.app 7 | 8 | # Sitemaps 9 | Sitemap: https://next-app-shanyue.vercel.app/sitemap.xml 10 | -------------------------------------------------------------------------------- /public/sitemap-0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | https://next-app-shanyue.vercel.app2022-09-12T14:58:12.847Zdaily0.7 4 | https://next-app-shanyue.vercel.app/1002022-09-12T14:58:12.847Zdaily0.7 5 | https://next-app-shanyue.vercel.app/1012022-09-12T14:58:12.847Zdaily0.7 6 | https://next-app-shanyue.vercel.app/1022022-09-12T14:58:12.847Zdaily0.7 7 | https://next-app-shanyue.vercel.app/1032022-09-12T14:58:12.847Zdaily0.7 8 | https://next-app-shanyue.vercel.app/2002022-09-12T14:58:12.847Zdaily0.7 9 | https://next-app-shanyue.vercel.app/2012022-09-12T14:58:12.847Zdaily0.7 10 | https://next-app-shanyue.vercel.app/2022022-09-12T14:58:12.847Zdaily0.7 11 | https://next-app-shanyue.vercel.app/2032022-09-12T14:58:12.847Zdaily0.7 12 | https://next-app-shanyue.vercel.app/2042022-09-12T14:58:12.847Zdaily0.7 13 | https://next-app-shanyue.vercel.app/2052022-09-12T14:58:12.847Zdaily0.7 14 | https://next-app-shanyue.vercel.app/2062022-09-12T14:58:12.847Zdaily0.7 15 | https://next-app-shanyue.vercel.app/2072022-09-12T14:58:12.847Zdaily0.7 16 | https://next-app-shanyue.vercel.app/2082022-09-12T14:58:12.847Zdaily0.7 17 | https://next-app-shanyue.vercel.app/2262022-09-12T14:58:12.847Zdaily0.7 18 | https://next-app-shanyue.vercel.app/3002022-09-12T14:58:12.847Zdaily0.7 19 | https://next-app-shanyue.vercel.app/3012022-09-12T14:58:12.847Zdaily0.7 20 | https://next-app-shanyue.vercel.app/3022022-09-12T14:58:12.847Zdaily0.7 21 | https://next-app-shanyue.vercel.app/3032022-09-12T14:58:12.847Zdaily0.7 22 | https://next-app-shanyue.vercel.app/3042022-09-12T14:58:12.847Zdaily0.7 23 | https://next-app-shanyue.vercel.app/3052022-09-12T14:58:12.847Zdaily0.7 24 | https://next-app-shanyue.vercel.app/3072022-09-12T14:58:12.847Zdaily0.7 25 | https://next-app-shanyue.vercel.app/3082022-09-12T14:58:12.847Zdaily0.7 26 | https://next-app-shanyue.vercel.app/4002022-09-12T14:58:12.847Zdaily0.7 27 | https://next-app-shanyue.vercel.app/4012022-09-12T14:58:12.847Zdaily0.7 28 | https://next-app-shanyue.vercel.app/4022022-09-12T14:58:12.847Zdaily0.7 29 | https://next-app-shanyue.vercel.app/4032022-09-12T14:58:12.847Zdaily0.7 30 | https://next-app-shanyue.vercel.app/4052022-09-12T14:58:12.847Zdaily0.7 31 | https://next-app-shanyue.vercel.app/4062022-09-12T14:58:12.847Zdaily0.7 32 | https://next-app-shanyue.vercel.app/4072022-09-12T14:58:12.847Zdaily0.7 33 | https://next-app-shanyue.vercel.app/4082022-09-12T14:58:12.847Zdaily0.7 34 | https://next-app-shanyue.vercel.app/4092022-09-12T14:58:12.847Zdaily0.7 35 | https://next-app-shanyue.vercel.app/4102022-09-12T14:58:12.847Zdaily0.7 36 | https://next-app-shanyue.vercel.app/4112022-09-12T14:58:12.847Zdaily0.7 37 | https://next-app-shanyue.vercel.app/4122022-09-12T14:58:12.847Zdaily0.7 38 | https://next-app-shanyue.vercel.app/4132022-09-12T14:58:12.847Zdaily0.7 39 | https://next-app-shanyue.vercel.app/4142022-09-12T14:58:12.847Zdaily0.7 40 | https://next-app-shanyue.vercel.app/4152022-09-12T14:58:12.847Zdaily0.7 41 | https://next-app-shanyue.vercel.app/4162022-09-12T14:58:12.847Zdaily0.7 42 | https://next-app-shanyue.vercel.app/4172022-09-12T14:58:12.848Zdaily0.7 43 | https://next-app-shanyue.vercel.app/4182022-09-12T14:58:12.848Zdaily0.7 44 | https://next-app-shanyue.vercel.app/4212022-09-12T14:58:12.848Zdaily0.7 45 | https://next-app-shanyue.vercel.app/4222022-09-12T14:58:12.848Zdaily0.7 46 | https://next-app-shanyue.vercel.app/4232022-09-12T14:58:12.848Zdaily0.7 47 | https://next-app-shanyue.vercel.app/4242022-09-12T14:58:12.848Zdaily0.7 48 | https://next-app-shanyue.vercel.app/4262022-09-12T14:58:12.848Zdaily0.7 49 | https://next-app-shanyue.vercel.app/4282022-09-12T14:58:12.848Zdaily0.7 50 | https://next-app-shanyue.vercel.app/4292022-09-12T14:58:12.848Zdaily0.7 51 | https://next-app-shanyue.vercel.app/4312022-09-12T14:58:12.848Zdaily0.7 52 | https://next-app-shanyue.vercel.app/4442022-09-12T14:58:12.848Zdaily0.7 53 | https://next-app-shanyue.vercel.app/4512022-09-12T14:58:12.848Zdaily0.7 54 | https://next-app-shanyue.vercel.app/4992022-09-12T14:58:12.848Zdaily0.7 55 | https://next-app-shanyue.vercel.app/5012022-09-12T14:58:12.848Zdaily0.7 56 | https://next-app-shanyue.vercel.app/5022022-09-12T14:58:12.848Zdaily0.7 57 | https://next-app-shanyue.vercel.app/5032022-09-12T14:58:12.848Zdaily0.7 58 | https://next-app-shanyue.vercel.app/5042022-09-12T14:58:12.848Zdaily0.7 59 | https://next-app-shanyue.vercel.app/5052022-09-12T14:58:12.848Zdaily0.7 60 | https://next-app-shanyue.vercel.app/5062022-09-12T14:58:12.848Zdaily0.7 61 | https://next-app-shanyue.vercel.app/5072022-09-12T14:58:12.848Zdaily0.7 62 | https://next-app-shanyue.vercel.app/5082022-09-12T14:58:12.848Zdaily0.7 63 | https://next-app-shanyue.vercel.app/5102022-09-12T14:58:12.848Zdaily0.7 64 | https://next-app-shanyue.vercel.app/5112022-09-12T14:58:12.848Zdaily0.7 65 | https://next-app-shanyue.vercel.app/5992022-09-12T14:58:12.848Zdaily0.7 66 | https://next-app-shanyue.vercel.app/about2022-09-12T14:58:12.848Zdaily0.7 67 | -------------------------------------------------------------------------------- /public/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | https://next-app-shanyue.vercel.app/sitemap-0.xml 4 | -------------------------------------------------------------------------------- /serverless.yaml: -------------------------------------------------------------------------------- 1 | component: nextjs # (必填) 组件名称,此处为nextjs 2 | name: next-app 3 | 4 | inputs: 5 | src: ./ 6 | functionName: next-app-fn 7 | region: ap-guangzhou 8 | runtime: Nodejs12.16 9 | exclude: 10 | - .env 11 | apigatewayConf: 12 | protocols: 13 | - http 14 | - https 15 | environment: release -------------------------------------------------------------------------------- /styles/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | 3 | @tailwind components; 4 | 5 | @tailwind utilities; 6 | 7 | @layer utilities { 8 | } 9 | 10 | @layer base { 11 | 12 | [multiple], 13 | [type=date], 14 | [type=datetime-local], 15 | [type=email], 16 | [type=month], 17 | [type=number], 18 | [type=password], 19 | [type=search], 20 | [type=tel], 21 | [type=text], 22 | [type=time], 23 | [type=url], 24 | [type=week], 25 | select, 26 | textarea { 27 | @apply px-3 py-2 leading-normal border appearance-none; 28 | } 29 | } 30 | 31 | @layer components { 32 | .app-button { 33 | @apply px-6 py-1 text-gray-700 bg-white border border-gray-400 rounded-full shadow-sm hover:border-orange-500 hover:text-orange-600 hover:ring-1 hover:ring-orange-500; 34 | } 35 | 36 | .app-input { 37 | @apply block w-full border-gray-400 rounded-md shadow-sm outline-none focus:ring-1 focus:ring-orange-500 focus:border-orange-500; 38 | } 39 | 40 | .markdown-body { 41 | @apply text-gray-700; 42 | } 43 | 44 | .markdown-body p, 45 | .markdown-body blockquote, 46 | .markdown-body ul, 47 | .markdown-body ol, 48 | .markdown-body dl, 49 | .markdown-body table, 50 | .markdown-body pre, 51 | .markdown-body details, 52 | .markdown-body hr { 53 | @apply mt-0 mb-4; 54 | } 55 | 56 | .markdown-body code, 57 | .page code, 58 | code { 59 | padding: 0.2em 0.4em; 60 | margin: 0; 61 | font-size: 85%; 62 | border-radius: 6px; 63 | @apply text-orange-600 border border-gray-200 bg-gray-50 before:content-[""] after:content-[""]; 64 | } 65 | 66 | .markdown-body pre > code { 67 | display: block; 68 | margin: 0; 69 | word-break: normal; 70 | overflow-x: auto; 71 | background: #1f2937; 72 | @apply text-gray-100 border-0; 73 | } 74 | 75 | .markdown-body p:first-of-type { 76 | @apply text-xl font-medium; 77 | } 78 | 79 | .page { 80 | max-width: 100%; 81 | margin-right: auto; 82 | margin-left: auto; 83 | } 84 | 85 | @media (min-width: 640px) { 86 | .page { 87 | max-width: 640px; 88 | } 89 | } 90 | 91 | @media (min-width: 768px) { 92 | .page { 93 | max-width: 768px; 94 | } 95 | } 96 | 97 | @media (min-width: 1024px) { 98 | .page { 99 | max-width: 960px; 100 | } 101 | } 102 | 103 | @media (min-width: 1280px) { 104 | .page { 105 | max-width: 960px; 106 | } 107 | } 108 | } -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | content: ['./components/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}'], 3 | theme: { 4 | container: { 5 | center: true 6 | }, 7 | extend: { 8 | typography: (theme) => ({ 9 | DEFAULT: { 10 | css: { 11 | maxWidth: '100%', 12 | a: { 13 | color: theme('colors.orange.400'), 14 | }, 15 | }, 16 | }, 17 | }), 18 | } 19 | }, 20 | variants: {}, 21 | plugins: [ 22 | require('@tailwindcss/typography') 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "strict": true, 12 | "forceConsistentCasingInFileNames": true, 13 | "noEmit": true, 14 | "esModuleInterop": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "jsx": "preserve", 20 | "incremental": true 21 | }, 22 | "exclude": [ 23 | "node_modules" 24 | ], 25 | "include": [ 26 | "next-env.d.ts", 27 | "**/*.ts", 28 | "**/*.tsx" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "rewrites": [ 3 | { 4 | "source": "/api/(.*)", 5 | "destination": "/api/index.ts" 6 | } 7 | ] 8 | } --------------------------------------------------------------------------------