@@ -45,7 +45,6 @@ import (
4545 * @property {string} [method] Request method
4646 * @property {[]*Params} [Params] Request path parameters
4747 * @property {query} [url.Values] Request path query params
48- * @property {IncomingHeader} [header] Incoming headers of the request
4948 * @property {json.Decoder} [json] Json decoder instance
5049 */
5150type Request struct {
@@ -54,7 +53,6 @@ type Request struct {
5453 body map [string ][]string
5554 method string
5655 Params map [string ]string
57- header * IncomingHeader
5856 json * json.Decoder
5957}
6058
@@ -66,16 +64,11 @@ type Request struct {
6664func request (r * http.Request ) * Request {
6765 req := & Request {
6866 ref : r ,
69- header : & IncomingHeader {},
7067 fileReader : nil ,
7168 method : r .Proto ,
7269 }
7370
74- for i , v := range r .Header {
75- req .header .Set (strings .ToLower (i ), strings .Join (v , "," ))
76- }
77-
78- if req .header .Get ("content-type" ) == "application/json" {
71+ if req .ref .Header .Get ("content-type" ) == "application/json" {
7972 req .json = json .NewDecoder (r .Body )
8073 } else {
8174 r .ParseForm ()
@@ -321,7 +314,7 @@ func (r *Request) GetCookie(key string) *http.Cookie {
321314 * @returns {*Request}
322315 */
323316func (r * Request ) SetHeader (key string , value string ) * Request {
324- r .header .Set (key , value )
317+ r .ref . Header .Set (key , value )
325318 return r
326319}
327320
@@ -331,5 +324,22 @@ func (r *Request) SetHeader(key string, value string) *Request {
331324 * @returns {string}
332325 */
333326func (r * Request ) GetHeader (key string ) string {
334- return r .header .Get (key )
327+ return r .ref .Header .Get (key )
328+ }
329+
330+
331+ /**
332+ * @info Deletes a paticular Header by its key
333+ * @param {string} [key] key of the Header
334+ */
335+ func (r * Request ) DelHeader (key string ) {
336+ r .ref .Header .Del (key )
337+ }
338+
339+ /**
340+ * @info Clones all headers from request body
341+ * @returns {http.Header}
342+ */
343+ func (r * Request ) CloneHeader () http.Header {
344+ return r .ref .Header .Clone ()
335345}
0 commit comments