@@ -72,7 +72,7 @@ func (g *Generator) Output() (io.Reader, error) {
7272 for i , t := range g .TestSuite .Tests {
7373 g .w ("\n " )
7474 g .genLocationYAML (t )
75- g .w ("\t " + `t.Run("` + strings . Title ( t .Name ) + `", ` + "func(t *testing.T) {\n " )
75+ g .w ("\t " + `t.Run("` + t .Name + `", ` + "func(t *testing.T) {\n " )
7676 if ! g .genSkip (t ) {
7777 g .w ("\t defer recoverPanic(t)\n " )
7878 g .w ("\t commonSetup()\n " )
@@ -1134,19 +1134,31 @@ func (g *Generator) genAction(a Action, skipBody ...bool) {
11341134 if strings .Contains (a .headers ["Accept" ], "yaml" ) && strings .HasPrefix (a .Request (), "Cat" ) {
11351135 g .w ("\t \t " + `Format: "yaml",` + "\n " )
11361136 }
1137- if auth_header , ok := a .headers ["Authorization" ]; ok {
1138- auth_fields := strings .Split (auth_header , " " )
1139- auth_name := auth_fields [0 ]
1140- auth_value := auth_fields [1 ]
1141- if strings .HasPrefix (auth_value , "$" ) {
1142- auth_value = `fmt.Sprintf("%s", stash["` + strings .ReplaceAll (strings .ReplaceAll (auth_value , "{" , "" ), "}" , "" ) + `"])`
1137+
1138+ g .w ("\t \t Header: http.Header{\n " )
1139+ for name , value := range a .headers {
1140+
1141+ if name == "Content-Type" && value == "application/json" {
1142+ continue
1143+ }
1144+
1145+ if name == "Authorization" {
1146+ auth_fields := strings .Split (value , " " )
1147+ auth_name := auth_fields [0 ]
1148+ auth_value := auth_fields [1 ]
1149+ if strings .HasPrefix (auth_value , "$" ) {
1150+ auth_value = `fmt.Sprintf("%s", stash["` + strings .ReplaceAll (strings .ReplaceAll (auth_value , "{" , "" ), "}" , "" ) + `"])`
1151+ } else {
1152+ auth_value = `"` + auth_value + `"`
1153+ }
1154+ g .w ("\t \t \t " + `"Authorization": []string{"` + auth_name + ` " + ` + auth_value + `},` + "\n " )
1155+
11431156 } else {
1144- auth_value = `"` + auth_value + `"`
1157+ g . w ( " \t \t \t \" " + name + " \" : []string{ \" " + value + " \" }, \n " )
11451158 }
1146- g .w ("\t \t " + `Header: http.Header{` + "\n " )
1147- g .w ("\t \t \t " + `"Authorization": []string{"` + auth_name + ` " + ` + auth_value + `},` + "\n " )
1148- g .w ("\t \t " + `},` + "\n " )
1159+
11491160 }
1161+ g .w ("\t \t },\n " )
11501162 }
11511163
11521164 g .w ("\t \t }\n \n " )
0 commit comments