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