Thrift請求後獲得HttpStatus413是什麼鬼?如下會爲你一一解答。服務器
c := pool.Get() defer pool.Put(c) 如下爲調用邏輯....
1.HttpStatus 413是什麼意思?網絡
HTTP Status 413 (請求實體過大)
服務器沒法處理請求,由於請求實體過大,超出服務器的處理能力。
注意:這裏請求實體過大的意思是包括header和body(一開始定位時只定位了body,就進坑了- -)this
針對該問題主要爲header過大code
2.RPC時會設置header,但對於存在於pool中的goroutine,是Addheader,請看如下代碼,繼承
// Set the HTTP Header for this specific Thrift Transport // It is important that you first assert the TTransport as a THttpClient type // like so: // // httpTrans := trans.(THttpClient) // httpTrans.SetHeader("User-Agent","Thrift Client 1.0") func (p *THttpClient) SetHeader(key string, value string) { p.header.Add(key, value) }
這就是致使出現413的緣由ci