File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ // response/parse.go
2+ package response
3+
4+ import (
5+ "reflect"
6+ "testing"
7+ )
8+
9+ func Test_parseHeader (t * testing.T ) {
10+ type args struct {
11+ header string
12+ }
13+ tests := []struct {
14+ name string
15+ args args
16+ want string
17+ want1 map [string ]string
18+ }{
19+ {
20+ name : "testing content type" ,
21+ args : args {
22+ header : "content-type:application/json;something" ,
23+ },
24+ want : "application/json" ,
25+ },
26+ }
27+ for _ , tt := range tests {
28+ t .Run (tt .name , func (t * testing.T ) {
29+ got , got1 := parseHeader (tt .args .header )
30+ if got != tt .want {
31+ t .Errorf ("parseHeader() got = %v, want %v" , got , tt .want )
32+ }
33+ if ! reflect .DeepEqual (got1 , tt .want1 ) {
34+ t .Errorf ("parseHeader() got1 = %v, want %v" , got1 , tt .want1 )
35+ }
36+ })
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments