GET request method


目录

The GET HTTP method requests a representation of the specified resource. Requests using GET should only be used to request data and shouldn't contain a body.

[!NOTE] The semantics of sending a message body in GET requests are undefined. Some servers may reject the request with a 4XX client error response.

Request has body No
Successful response has body Yes
{{Glossary("Safe/HTTP", "Safe")}} Yes
{{Glossary("Idempotent")}} Yes
{{Glossary("Cacheable")}} Yes
Allowed in HTML forms Yes

Syntax

GET <request-target>["?"<query>] HTTP/1.1

Examples

Successfully retrieving a resource

The following GET request asks for the resource at example.com/contact:

GET /contact HTTP/1.1
Host: example.com
User-Agent: curl/8.6.0
Accept: */*

The server sends back the resource with a {{HTTPStatus("200", "200 OK")}} status code, indicating success:

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Date: Fri, 21 Jun 2024 14:18:33 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Content-Length: 1234

<!doctype html>
<!-- HTML content follows -->

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also


版本号 #2
由 壳壳虫 创建于 2026-10-31 03:27:53 UTC
由 壳壳虫 更新于 2026-10-31 03:27:53 UTC