對於 GET
方法,會將數據轉換爲 query string。例如 { name: 'name', age: 18 }
轉換後的結果是 name=name&age=18
。json
對於 POST
方法且 header['content-type']
爲 application/json
的數據,會進行 JSON 序列化。app
對於 POST
方法且 header['content-type']
爲 application/x-www-form-urlencoded
的數據,會將數據轉換爲 query string。url
當傳輸的數據爲多個字符串時須要將對象類型轉化爲 query string 類型,須要自定義頭文件。code