---
# System prepended metadata

title: HTTP request
tags: [HTTP Headers, Request]

---

---
title: 'HTTP request'
disqus: hackmd
---

HTTP request
===
![downloads](https://img.shields.io/github/downloads/atom/atom/total.svg)
![build](https://img.shields.io/appveyor/ci/:user/:repo.svg)
![chat](https://img.shields.io/discord/:serverId.svg)

## Table of Contents

[TOC]


---

怎麼看Http request
---

1. 使用google chrome瀏覽器
2. 按下F12
3. 找到Network
4. 點選任一Name
5. 查看右邊的Headers

> request的部分我會查看General區域&Request Headers區域 


Http request 的架構
---

我開啟目前這一頁XDD
選擇一個Name, template
```gherkin=
//General區域

Request URL: https://hackmd.io/template
Request Method: GET

//Request Headers區域

:authority: hackmd.io
:method: GET
:path: /template
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-CN;q=0.6
cache-control: no-cache
cookie: locale=zh-TW; connect.sid=s%3AE_0FvgLUyxFh-uoqV2cs-Y0HI0UDydyu.vbEI1SEnXzPDU51lAGmBtHzWpRm3YZvbq%2FztU4CTYxc; _ga=GA1.2.1123248005.1562912759; indent_type=space; space_units=4; keymap=sublime; comment-onboard=true; __qca=P0-847385191-1562912758808; loginstate=true; userid=0846adda-1ea4-44e3-a368-018b2de9c93b; AWSALB=osxgZv2cjaJg6OMSteH7jD55MFRTeEMaxJPqCKekncWMqLx0fiPcCAxlmzpEWMmDI4/4ZvYFiQXr4n1tx2/DNu5MqSyK/jkuHhI1vVuuIamzbNUUq091O/Mxsthv; _csrf=6W_7kYbhYGLlRr6hnOK4Hhd5; notesSortStrategy=new_to_old; sectionsSortStrategy=cat_new_to_old; sectionFilterApplied=true; showNoteTypeStrategy=show-notes; _gid=GA1.2.561017690.1567233204; _gat_gtag_UA_60728495_1=1; io=5tKN7ZixMURzHAihAndk
pragma: no-cache
referer: https://hackmd.io/-yvLkOzYQdOLD0SGNorChA
sec-fetch-mode: cors
sec-fetch-site: same-origin
user-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
x-requested-with: XMLHttpRequest
x-xsrf-token: uZ1cHPLq-RCcnZuTU18IVGHRC90ExR28P8og
```

> 欄位解釋可參考維基百科 - HTTP Header Field

上面範例常見到的：

>Request URL：請求網址

>Request Method：請求方法，根據不同情境使用不同方法

>accept：能夠接受的回應內容類型（Content-Types）

>Accept-Encoding：能夠接受的編碼方式列表

>Accept-Language：能夠接受的回應內容的語言列表

>Cookie：傳送瀏覽器所存的cookie給伺服器

>Referer：url訊息

>user-agent：瀏覽器的瀏覽器身分標識字串



Request Method
---
上面範例是使用GET，我自己常用的是GET跟POST

>GET：把提交資料弄在URL上，取得我們想要的資料

>POST：把提交資料放message body中，傳給指定的URL做處理

>HEAD

>PUT

>DELETE

>CONNECT

>OPTIONS

>TRACE

>PATCH

延伸問題：GET VS POST


## Appendix and FAQ

:::info
**Find this document incomplete?** Leave a comment!
:::

###### tags: `HTTP Headers` `Request`