77package main
88
99import (
10+ "net/http"
1011 "testing"
1112
1213 "github.com/getkin/kin-openapi/openapi3"
@@ -298,7 +299,7 @@ func TestExpandUnionPaths(t *testing.T) {
298299 return pathVariant {
299300 path : path ,
300301 pathParams : append ([]string (nil ), params ... ),
301- methods : map [string ]struct {}{"GET" : {}},
302+ methods : map [string ]struct {}{http . MethodGet : {}},
302303 arrayParams : map [string ]bool {},
303304 }
304305 }
@@ -429,18 +430,18 @@ func TestExpandUnionPaths_DeepCopiesMaps(t *testing.T) {
429430 original := pathVariant {
430431 path : "/_nodes/{node_id_or_metric}" ,
431432 pathParams : []string {"node_id_or_metric" },
432- methods : map [string ]struct {}{"GET" : {}},
433+ methods : map [string ]struct {}{http . MethodGet : {}},
433434 arrayParams : map [string ]bool {"node_id_or_metric" : true },
434435 }
435436 g := opGroup {
436437 name : "nodes.info" ,
437438 pathSpecs : []pathVariant {
438- {path : "/_nodes" , methods : map [string ]struct {}{"GET" : {}}},
439+ {path : "/_nodes" , methods : map [string ]struct {}{http . MethodGet : {}}},
439440 original ,
440441 {
441442 path : "/_nodes/{node_id}/{metric}" ,
442443 pathParams : []string {"node_id" , "metric" },
443- methods : map [string ]struct {}{"GET" : {}},
444+ methods : map [string ]struct {}{http . MethodGet : {}},
444445 arrayParams : map [string ]bool {},
445446 },
446447 },
@@ -465,7 +466,7 @@ func TestExpandUnionPaths_DeepCopiesMaps(t *testing.T) {
465466 require .NotNil (t , syn1 , "expected /_nodes/{node_id} synthetic variant" )
466467 require .NotNil (t , syn2 , "expected /_nodes/{metric} synthetic variant" )
467468
468- syn1 .methods ["POST" ] = struct {}{}
469- require .NotContains (t , syn2 .methods , "POST" , "synthetic variants share no method map" )
470- require .NotContains (t , original .methods , "POST" , "synthetic mutation leaked into original" )
469+ syn1 .methods [http . MethodPost ] = struct {}{}
470+ require .NotContains (t , syn2 .methods , http . MethodPost , "synthetic variants share no method map" )
471+ require .NotContains (t , original .methods , http . MethodPost , "synthetic mutation leaked into original" )
471472}
0 commit comments