Golang的包net / http / transport可以在
中自动设置<script>
$(document).ready(function ()
{
$('#companies').DataTable( {
"ajax": {
url: "/Company/GetCompanyGrid",
type: "GET",
dataType: "json"
},"columns": [
{ "data": "Id" },
{ "data": "RegNo" },
{ "data": "Name" },
{ "data": "Industry" },
{ "data": "Size" },
{ "data": "LineOfDefence" },
{ "data": "Address" },
{ "data": "Logo" },
{ "data": null },
]
});
});
</script>
标头
Proxy-Authorization
像
func (t *Transport) dialConn(ctx context.Context, cm connectMethod) (*persistConn, error)
但我需要将X-Header提交给代理服务器。我如何自定义传输CONNECT方法请求标头?
答案 0 :(得分:0)
怎么样:
// ...
request, err := http.NewRequest("GET", "https://www.google.com", nil)
if err != nil {
// do something
}
// add header here.
request.Header.Add("X-Header", "xxx")
response, err := client.Do(request)
if err != nil {
// do something
}
// ...